Skip to content

Commit

Permalink
Deprecate PixelKit daily pixel suffixes (#3509)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1208695427490034/f
Tech Design URL:
CC:

Description:

This PR updates the app to use the new legacyDailyAndCount PixelKit suffix type.
  • Loading branch information
samsymons authored Nov 6, 2024
1 parent a8de1e0 commit d6f051a
Show file tree
Hide file tree
Showing 29 changed files with 145 additions and 145 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14778,7 +14778,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 203.3.0;
version = 204.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "64a5d8d1e19951fe397305a14e521713fb0eaa49",
"version" : "203.3.0"
"revision" : "14594b6f3f3ddbea65be2818298e2e79305d8a26",
"version" : "204.0.0"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class DataBrokerProtectionPixelsHandler: EventMapping<DataBrokerProtectio
.ipcServerImmediateScansFinishedWithError(error: let error),
.ipcServerAppLaunchedXPCError(error: let error),
.ipcServerAppLaunchedScheduledScansFinishedWithError(error: let error):
PixelKit.fire(DebugEvent(event, error: error), frequency: .dailyAndCount, includeAppVersionParameter: true)
PixelKit.fire(DebugEvent(event, error: error), frequency: .legacyDailyAndCount, includeAppVersionParameter: true)
case .ipcServerProfileSavedCalledByApp,
.ipcServerProfileSavedReceivedByAgent,
.ipcServerImmediateScansInterrupted,
Expand All @@ -50,7 +50,7 @@ public class DataBrokerProtectionPixelsHandler: EventMapping<DataBrokerProtectio
.ipcServerAppLaunchedScheduledScansBlocked,
.ipcServerAppLaunchedScheduledScansInterrupted,
.ipcServerAppLaunchedScheduledScansFinishedWithoutError:
PixelKit.fire(event, frequency: .dailyAndCount, includeAppVersionParameter: true)
PixelKit.fire(event, frequency: .legacyDailyAndCount, includeAppVersionParameter: true)
case .parentChildMatches,
.optOutStart,
.optOutEmailGenerate,
Expand Down Expand Up @@ -122,7 +122,7 @@ public class DataBrokerProtectionPixelsHandler: EventMapping<DataBrokerProtectio
.entitlementCheckValid,
.entitlementCheckInvalid,
.entitlementCheckError:
PixelKit.fire(event, frequency: .dailyAndCount)
PixelKit.fire(event, frequency: .legacyDailyAndCount)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/LoginItems/LoginItemsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ final class LoginItemsManager: LoginItemsManaging {
action: "enable",
buildType: AppVersion.shared.buildType,
osVersion: AppVersion.shared.osVersion)
PixelKit.fire(DebugEvent(event, error: error), frequency: .dailyAndCount)
PixelKit.fire(DebugEvent(event, error: error), frequency: .legacyDailyAndCount)
Logger.networkProtection.error("Could not enable \(item.debugDescription, privacy: .public): \(error.debugDescription, privacy: .public)")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ extension EventMapping where Event == NetworkProtectionError {
frequency = .standard
case .failedToFetchLocationList(let error):
domainEvent = .networkProtectionClientFailedToFetchLocations(error)
frequency = .dailyAndCount
frequency = .legacyDailyAndCount
case .failedToParseLocationListResponse(let error):
domainEvent = .networkProtectionClientFailedToParseLocationsResponse(error)
frequency = .dailyAndCount
frequency = .legacyDailyAndCount
case .noServerRegistrationInfo,
.couldNotSelectClosestServer,
.couldNotGetPeerPublicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ final class NetworkProtectionTunnelController: TunnelController, TunnelSessionPr
func start() async {
VPNOperationErrorRecorder().beginRecordingControllerStart()
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionControllerStartAttempt,
frequency: .dailyAndCount)
frequency: .legacyDailyAndCount)
controllerErrorStore.lastErrorMessage = nil

do {
Expand Down Expand Up @@ -580,19 +580,19 @@ final class NetworkProtectionTunnelController: TunnelController, TunnelSessionPr
// in the packet tunnel provider side that can be used to debug additional logic.
//
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionControllerStartSuccess,
frequency: .dailyAndCount)
frequency: .legacyDailyAndCount)
}
} catch {
VPNOperationErrorRecorder().recordControllerStartFailure(error)
knownFailureStore.lastKnownFailure = KnownFailure(error)

if case StartError.cancelled = error {
PixelKit.fire(
NetworkProtectionPixelEvent.networkProtectionControllerStartCancelled, frequency: .dailyAndCount, includeAppVersionParameter: true
NetworkProtectionPixelEvent.networkProtectionControllerStartCancelled, frequency: .legacyDailyAndCount, includeAppVersionParameter: true
)
} else {
PixelKit.fire(
NetworkProtectionPixelEvent.networkProtectionControllerStartFailure(error), frequency: .dailyAndCount, includeAppVersionParameter: true
NetworkProtectionPixelEvent.networkProtectionControllerStartFailure(error), frequency: .legacyDailyAndCount, includeAppVersionParameter: true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ final class VPNLocationViewModel: ObservableObject {
}

func onNearestItemSelection() async {
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingSetNearest, frequency: .dailyAndCount)
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingSetNearest, frequency: .legacyDailyAndCount)
selectedLocation = .nearest
await reloadList()
}

func onCountryItemSelection(id: String, cityId: String? = nil) async {
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingSetCustom, frequency: .dailyAndCount)
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingSetCustom, frequency: .legacyDailyAndCount)
let city = cityId == VPNCityItemModel.nearest.id ? nil : cityId
let location = NetworkProtectionSelectedLocation(country: id, city: city)
selectedLocation = .location(location)
Expand All @@ -95,7 +95,7 @@ final class VPNLocationViewModel: ObservableObject {
private func reloadList() async {
guard let locations = try? await locationListRepository.fetchLocationList().sortedByName() else { return }
if locations.isEmpty {
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingNoLocations, frequency: .dailyAndCount)
PixelKit.fire(GeneralPixel.networkProtectionGeoswitchingNoLocations, frequency: .legacyDailyAndCount)
}
let isNearestSelected = selectedLocation == .nearest
self.isNearestSelected = isNearestSelected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension NetworkProtectionIPCTunnelController: TunnelController {
knownFailureStore.lastKnownFailure = KnownFailure(error)
errorRecorder.recordIPCStartFailure(error)
log(error)
pixelKit?.fire(StartAttempt.failure(error), frequency: .dailyAndCount)
pixelKit?.fire(StartAttempt.failure(error), frequency: .legacyDailyAndCount)
}

do {
Expand All @@ -112,7 +112,7 @@ extension NetworkProtectionIPCTunnelController: TunnelController {
if let error {
handleFailure(error)
} else {
pixelKit?.fire(StartAttempt.success, frequency: .dailyAndCount)
pixelKit?.fire(StartAttempt.success, frequency: .legacyDailyAndCount)
}
}
} catch {
Expand All @@ -126,7 +126,7 @@ extension NetworkProtectionIPCTunnelController: TunnelController {

func handleFailure(_ error: Error) {
log(error)
pixelKit?.fire(StopAttempt.failure(error), frequency: .dailyAndCount)
pixelKit?.fire(StopAttempt.failure(error), frequency: .legacyDailyAndCount)
}

do {
Expand All @@ -136,7 +136,7 @@ extension NetworkProtectionIPCTunnelController: TunnelController {
if let error {
handleFailure(error)
} else {
pixelKit?.fire(StopAttempt.success, frequency: .dailyAndCount)
pixelKit?.fire(StopAttempt.success, frequency: .legacyDailyAndCount)
}
}
} catch {
Expand Down
Loading

0 comments on commit d6f051a

Please sign in to comment.