diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 5979ae8e34..0f7dfe051b 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13121,7 +13121,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 103.0.2; + version = 104.0.0; }; }; AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 070c0ff620..ba08c60785 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "1f7a1b5fe1c404d331fe34e55c99296828107c1d", - "version" : "103.0.2" + "revision" : "872090e651ad8e26ca9903a95f3d094b21d48e23", + "version" : "104.0.0" } }, { diff --git a/DuckDuckGo/Application/AppDelegate.swift b/DuckDuckGo/Application/AppDelegate.swift index 855e63574e..a21ee4afea 100644 --- a/DuckDuckGo/Application/AppDelegate.swift +++ b/DuckDuckGo/Application/AppDelegate.swift @@ -29,6 +29,7 @@ import DDGSync import ServiceManagement import SyncDataProviders import UserNotifications +import PixelKit #if NETWORK_PROTECTION import NetworkProtection @@ -117,8 +118,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, FileDownloadManagerDel if NSApplication.runType.requiresEnvironment { #if DEBUG Pixel.setUp(dryRun: true) + Self.setUpPixelKit(dryRun: true) #else Pixel.setUp() + Self.setUpPixelKit(dryRun: false) #endif Database.shared.loadStore { _, error in @@ -360,6 +363,33 @@ final class AppDelegate: NSObject, NSApplicationDelegate, FileDownloadManagerDel appearancePreferences.updateUserInterfaceStyle() } + private static func setUpPixelKit(dryRun: Bool) { +#if NETWORK_PROTECTION +#if APPSTORE + let source = "browser-appstore" +#else + let source = "browser-dmg" +#endif + + PixelKit.setUp(dryRun: dryRun, + appVersion: AppVersion.shared.versionNumber, + source: source, + defaultHeaders: [:], + log: .networkProtectionPixel, + 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) + 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) + } + } +#endif + } + // MARK: - Sync private func startupSync() { diff --git a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift index 3f0b9b0633..57bc697fbe 100644 --- a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift +++ b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift @@ -66,6 +66,7 @@ enum NetworkProtectionPixelEvent: PixelKitEvent { case networkProtectionKeychainErrorFailedToCastKeychainValueToData(field: String) case networkProtectionKeychainReadError(field: String, status: Int32) case networkProtectionKeychainWriteError(field: String, status: Int32) + case networkProtectionKeychainUpdateError(field: String, status: Int32) case networkProtectionKeychainDeleteError(status: Int32) case networkProtectionWireguardErrorCannotLocateTunnelFileDescriptor @@ -190,6 +191,9 @@ enum NetworkProtectionPixelEvent: PixelKitEvent { case .networkProtectionKeychainWriteError: return "m_mac_netp_keychain_error_write_failed" + case .networkProtectionKeychainUpdateError: + return "m_mac_netp_keychain_error_update_failed" + case .networkProtectionKeychainDeleteError: return "m_mac_netp_keychain_error_delete_failed" @@ -239,6 +243,12 @@ enum NetworkProtectionPixelEvent: PixelKitEvent { PixelKit.Parameters.errorCode: String(status) ] + case .networkProtectionKeychainUpdateError(let field, let status): + return [ + PixelKit.Parameters.keychainFieldName: field, + PixelKit.Parameters.errorCode: String(status) + ] + case .networkProtectionKeychainDeleteError(let status): return [ PixelKit.Parameters.errorCode: String(status) diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift index b0b7edd33b..60b9120fb0 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift @@ -53,6 +53,9 @@ extension EventMapping where Event == NetworkProtectionError { case .keychainWriteError(field: let field, status: let status): domainEvent = .networkProtectionKeychainWriteError(field: field, status: status) frequency = .standard + case .keychainUpdateError(field: let field, status: let status): + domainEvent = .networkProtectionKeychainUpdateError(field: field, status: status) + frequency = .standard case .keychainDeleteError(status: let status): domainEvent = .networkProtectionKeychainDeleteError(status: status) frequency = .standard diff --git a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift index d8efd1e119..5770b78a2f 100644 --- a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift +++ b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift @@ -100,6 +100,8 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { domainEvent = .networkProtectionKeychainReadError(field: field, status: status) case .keychainWriteError(let field, let status): domainEvent = .networkProtectionKeychainWriteError(field: field, status: status) + case .keychainUpdateError(let field, let status): + domainEvent = .networkProtectionKeychainUpdateError(field: field, status: status) case .keychainDeleteError(let status): domainEvent = .networkProtectionKeychainDeleteError(status: status) case .wireGuardCannotLocateTunnelFileDescriptor: diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index b009fb2e0a..738721c96a 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), .package(path: "../PixelKit"), .package(path: "../SwiftUIExtensions"), .package(path: "../XPCHelper") diff --git a/LocalPackages/LoginItems/Package.swift b/LocalPackages/LoginItems/Package.swift index 0ec5967072..bcd932b77f 100644 --- a/LocalPackages/LoginItems/Package.swift +++ b/LocalPackages/LoginItems/Package.swift @@ -13,7 +13,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target( diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 4806bd3bf5..af75282a15 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -30,7 +30,7 @@ let package = Package( .library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), .package(path: "../XPCHelper"), .package(path: "../SwiftUIExtensions") ], diff --git a/LocalPackages/PixelKit/Package.swift b/LocalPackages/PixelKit/Package.swift index b7f4d3e9ab..81d1145d44 100644 --- a/LocalPackages/PixelKit/Package.swift +++ b/LocalPackages/PixelKit/Package.swift @@ -20,7 +20,7 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target( diff --git a/LocalPackages/Subscription/Package.swift b/LocalPackages/Subscription/Package.swift index 915ac9da17..6c5745d537 100644 --- a/LocalPackages/Subscription/Package.swift +++ b/LocalPackages/Subscription/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["Subscription"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target( diff --git a/LocalPackages/SwiftUIExtensions/Package.swift b/LocalPackages/SwiftUIExtensions/Package.swift index 5ef6269f9c..0638b411ba 100644 --- a/LocalPackages/SwiftUIExtensions/Package.swift +++ b/LocalPackages/SwiftUIExtensions/Package.swift @@ -11,7 +11,7 @@ let package = Package( .library(name: "PreferencesViews", targets: ["PreferencesViews"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target( diff --git a/LocalPackages/SyncUI/Package.swift b/LocalPackages/SyncUI/Package.swift index b6e596192a..a5fcabcd53 100644 --- a/LocalPackages/SyncUI/Package.swift +++ b/LocalPackages/SyncUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( ], dependencies: [ .package(path: "../SwiftUIExtensions"), - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target( diff --git a/LocalPackages/SystemExtensionManager/Package.swift b/LocalPackages/SystemExtensionManager/Package.swift index b1e1f8f089..dc93c08263 100644 --- a/LocalPackages/SystemExtensionManager/Package.swift +++ b/LocalPackages/SystemExtensionManager/Package.swift @@ -16,7 +16,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/XPCHelper/Package.swift b/LocalPackages/XPCHelper/Package.swift index 4136a3eda9..4ad4fef753 100644 --- a/LocalPackages/XPCHelper/Package.swift +++ b/LocalPackages/XPCHelper/Package.swift @@ -30,7 +30,7 @@ let package = Package( .library(name: "XPCHelper", targets: ["XPCHelper"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "103.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "104.0.0"), ], targets: [ .target(