Skip to content

Commit

Permalink
Remove temporary notification pixels (#2803)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1193060753475688/1207145810980144/f
Tech Design URL:
CC:

Description:

Removes changes from #2681
  • Loading branch information
samsymons authored Jun 5, 2024
1 parent 05bc6ef commit 62e901e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 121 deletions.
24 changes: 0 additions & 24 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1099,12 +1099,6 @@
4B1E6EEE27AB5E5100F51793 /* PasswordManagementListSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E6EEC27AB5E5100F51793 /* PasswordManagementListSection.swift */; };
4B1E6EF127AB5E5D00F51793 /* NSPopUpButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E6EEF27AB5E5D00F51793 /* NSPopUpButtonView.swift */; };
4B1E6EF227AB5E5D00F51793 /* PasswordManagementItemList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E6EF027AB5E5D00F51793 /* PasswordManagementItemList.swift */; };
4B1EFF1C2BD71EEF007CC84F /* PixelKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4B1EFF1B2BD71EEF007CC84F /* PixelKit */; };
4B1EFF1D2BD71FCA007CC84F /* UserDefaultsWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C6A29525CC1FFD00EEB5F1 /* UserDefaultsWrapper.swift */; };
4B1EFF1E2BD72034007CC84F /* BundleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6106B9D26A565DA0013B453 /* BundleExtension.swift */; };
4B1EFF1F2BD72170007CC84F /* OptionalExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B637273C26CCF0C200C8CB02 /* OptionalExtension.swift */; };
4B1EFF212BD72189007CC84F /* Networking in Frameworks */ = {isa = PBXBuildFile; productRef = 4B1EFF202BD72189007CC84F /* Networking */; };
4B1EFF222BD7223D007CC84F /* NetworkProtectionPixelEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF0E5042AD2551A00FFEC9E /* NetworkProtectionPixelEvent.swift */; };
4B25375B2A11BE7300610219 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B4D603E2A0B290200BCD287 /* NetworkExtension.framework */; };
4B2537722A11BF8B00610219 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B25376F2A11BF8B00610219 /* main.swift */; };
4B25377A2A11C01700610219 /* UserText+NetworkProtectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D607C2A0B29FA00BCD287 /* UserText+NetworkProtectionExtensions.swift */; };
Expand Down Expand Up @@ -4272,9 +4266,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4B1EFF1C2BD71EEF007CC84F /* PixelKit in Frameworks */,
7B624F172BA25C1F00A6C544 /* NetworkProtectionUI in Frameworks */,
4B1EFF212BD72189007CC84F /* Networking in Frameworks */,
37269F052B3332C2005E8E46 /* Common in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -8544,8 +8536,6 @@
packageProductDependencies = (
37269F042B3332C2005E8E46 /* Common */,
7B624F162BA25C1F00A6C544 /* NetworkProtectionUI */,
4B1EFF1B2BD71EEF007CC84F /* PixelKit */,
4B1EFF202BD72189007CC84F /* Networking */,
);
productName = DuckDuckGoNotifications;
productReference = 4B4BEC202A11B4E2001D9AC5 /* DuckDuckGo Notifications.app */;
Expand Down Expand Up @@ -10821,13 +10811,9 @@
4B4BEC432A11B5C7001D9AC5 /* Bundle+VPN.swift in Sources */,
4B4BEC452A11B5EE001D9AC5 /* UserText+NetworkProtectionExtensions.swift in Sources */,
4B4BEC422A11B5C7001D9AC5 /* NetworkProtectionOptionKeyExtension.swift in Sources */,
4B1EFF1D2BD71FCA007CC84F /* UserDefaultsWrapper.swift in Sources */,
B602E8222A1E2603006D261F /* Bundle+NetworkProtectionExtensions.swift in Sources */,
4B1EFF222BD7223D007CC84F /* NetworkProtectionPixelEvent.swift in Sources */,
B602E81A2A1E2570006D261F /* URL+NetworkProtection.swift in Sources */,
4B1EFF1F2BD72170007CC84F /* OptionalExtension.swift in Sources */,
EEAD7A7C2A1D3E20002A24E7 /* AppLauncher.swift in Sources */,
4B1EFF1E2BD72034007CC84F /* BundleExtension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -13225,16 +13211,6 @@
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Navigation;
};
4B1EFF1B2BD71EEF007CC84F /* PixelKit */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = PixelKit;
};
4B1EFF202BD72189007CC84F /* Networking */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Networking;
};
4B2D062B2A11C0E100DE1F49 /* Networking */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {

case networkProtectionUnhandledError(function: String, line: Int, error: Error)

// Temporary pixels added to verify notification delivery rates:
case networkProtectionConnectedNotificationDisplayed
case networkProtectionDisconnectedNotificationDisplayed
case networkProtectionReconnectingNotificationDisplayed
case networkProtectionSupersededNotificationDisplayed
case networkProtectionExpiredEntitlementNotificationDisplayed

/// Name of the pixel event
/// - Unique pixels must end with `_u`
/// - Daily pixels will automatically have `_d` or `_c` appended to their names
Expand Down Expand Up @@ -284,21 +277,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {

case .networkProtectionUnhandledError:
return "netp_unhandled_error"

case .networkProtectionConnectedNotificationDisplayed:
return "netp_connected_notification_displayed"

case .networkProtectionDisconnectedNotificationDisplayed:
return "netp_disconnected_notification_displayed"

case .networkProtectionReconnectingNotificationDisplayed:
return "netp_reconnecting_notification_displayed"

case .networkProtectionSupersededNotificationDisplayed:
return "netp_superseded_notification_displayed"

case .networkProtectionExpiredEntitlementNotificationDisplayed:
return "netp_expired_entitlement_notification_displayed"
}
}

Expand Down Expand Up @@ -387,12 +365,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionRekeyAttempt,
.networkProtectionRekeyCompleted,
.networkProtectionRekeyFailure,
.networkProtectionSystemExtensionActivationFailure,
.networkProtectionConnectedNotificationDisplayed,
.networkProtectionDisconnectedNotificationDisplayed,
.networkProtectionReconnectingNotificationDisplayed,
.networkProtectionSupersededNotificationDisplayed,
.networkProtectionExpiredEntitlementNotificationDisplayed:
.networkProtectionSystemExtensionActivationFailure:
return nil
}
}
Expand Down Expand Up @@ -458,12 +431,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionWireguardErrorCannotStartWireguardBackend,
.networkProtectionNoAuthTokenFoundError,
.networkProtectionRekeyAttempt,
.networkProtectionRekeyCompleted,
.networkProtectionConnectedNotificationDisplayed,
.networkProtectionDisconnectedNotificationDisplayed,
.networkProtectionReconnectingNotificationDisplayed,
.networkProtectionSupersededNotificationDisplayed,
.networkProtectionExpiredEntitlementNotificationDisplayed:
.networkProtectionRekeyCompleted:
return nil
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Foundation
import UserNotifications
import NetworkProtection
import NetworkProtectionUI
import PixelKit

extension UNNotificationAction {

Expand Down Expand Up @@ -160,20 +159,6 @@ final class NetworkProtectionUNNotificationsPresenter: NSObject, NetworkProtecti
_=self.registerNotificationCategoriesOnce
self.userNotificationCenter.removeDeliveredNotifications(withIdentifiers: [identifier.rawValue])
self.userNotificationCenter.add(request)

switch identifier {
case .disconnected:
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionDisconnectedNotificationDisplayed, frequency: .dailyAndCount)
case .reconnecting:
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionReconnectingNotificationDisplayed, frequency: .dailyAndCount)
case .connected:
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionConnectedNotificationDisplayed, frequency: .dailyAndCount)
case .superseded:
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionSupersededNotificationDisplayed, frequency: .dailyAndCount)
case .expiredEntitlement:
PixelKit.fire(NetworkProtectionPixelEvent.networkProtectionExpiredEntitlementNotificationDisplayed, frequency: .dailyAndCount)
case .test: break
}
}
}

Expand Down
48 changes: 0 additions & 48 deletions DuckDuckGoNotifications/DuckDuckGoNotificationsAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import Cocoa
import Combine
import Common
import Networking
import PixelKit
import NetworkExtension
import NetworkProtection

Expand Down Expand Up @@ -71,38 +69,6 @@ final class DuckDuckGoNotificationsAppDelegate: NSObject, NSApplicationDelegate
func applicationDidFinishLaunching(_ aNotification: Notification) {
os_log("Login item finished launching", log: .networkProtectionLoginItemLog, type: .info)

let dryRun: Bool

#if DEBUG
dryRun = true
#else
dryRun = false
#endif

let pixelSource: String

#if NETP_SYSTEM_EXTENSION
pixelSource = "vpnNotificationAgent"
#else
pixelSource = "vpnNotificationAgentAppStore" // Should never get used, but just in case
#endif

PixelKit.setUp(dryRun: dryRun,
appVersion: AppVersion.shared.versionNumber,
source: pixelSource,
defaultHeaders: [:],
defaults: .netP) { (pixelName: String, headers: [String: String], parameters: [String: String], _, _, onComplete: @escaping PixelKit.CompletionBlock) in

let url = URL.pixelUrl(forPixelNamed: pixelName)
let apiHeaders = APIRequest.Headers(additionalHeaders: headers) // workaround - Pixel class should really handle APIRequest.Headers by itself
let configuration = APIRequest.Configuration(url: url, method: .get, queryParameters: parameters, headers: apiHeaders)
let request = APIRequest(configuration: configuration)

request.fetch { _, error in
onComplete(error == nil, error)
}
}

startObservingVPNStatusChanges()
os_log("Login item listening")
}
Expand Down Expand Up @@ -191,17 +157,3 @@ final class DuckDuckGoNotificationsAppDelegate: NSObject, NSApplicationDelegate
}

}

extension NSApplication {

enum RunType: Int, CustomStringConvertible {
case normal
var description: String {
switch self {
case .normal: return "normal"
}
}
}
static var runType: RunType { .normal }

}

0 comments on commit 62e901e

Please sign in to comment.