From b357a9c60259b19c60064449208287d1842fe631 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Thu, 19 Oct 2023 15:23:34 +0100 Subject: [PATCH 1/3] dashboard updates --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 7 +++---- .../View/PrivacyDashboardViewController.swift | 6 ++++-- DuckDuckGo/Statistics/PixelEvent.swift | 9 +++++++++ DuckDuckGo/Statistics/PixelParameters.swift | 8 ++++++++ .../PixelKit/Sources/PixelKit/PixelKit+Parameters.swift | 3 +++ 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 1d862638df..2d53adf592 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -14066,8 +14066,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 81.5.0; + branch = "shane/form-updates"; + kind = branch; }; }; AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 34f9f56ede..3e650a07ff 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" : "c427dc63421c4b394f54c245de8e5665bcd6966a", - "version" : "81.5.0" + "branch" : "shane/form-updates", + "revision" : "10298bbd53fb60d865b2b0f8738994eadc1697a7" } }, { @@ -77,8 +77,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/privacy-dashboard", "state" : { - "revision" : "51e2b46f413bf3ef18afefad631ca70f2c25ef70", - "version" : "1.4.0" + "revision" : "f505d33c24568af44b770aaa60d64ff1564de9dc" } }, { diff --git a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift index 538096a36e..93fa21b119 100644 --- a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift +++ b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift @@ -171,16 +171,18 @@ final class PrivacyDashboardViewController: NSViewController { extension PrivacyDashboardViewController: PrivacyDashboardControllerDelegate { - func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, didChangeProtectionSwitch isEnabled: Bool) { + func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, didChangeProtectionSwitch protectionState: ProtectionState) { guard let domain = privacyDashboardController.privacyInfo?.url.host else { return } let configuration = ContentBlocking.shared.privacyConfigurationManager.privacyConfig - if isEnabled && configuration.isUserUnprotected(domain: domain) { + if protectionState.isProtected && configuration.isUserUnprotected(domain: domain) { configuration.userEnabledProtection(forDomain: domain) + Pixel.fire(.dashboardProtectionAllowlistRemove(triggerOrigin: protectionState.eventOrigin.screen.rawValue), includeAppVersionParameter: false) } else { configuration.userDisabledProtection(forDomain: domain) + Pixel.fire(.dashboardProtectionAllowlistAdd(triggerOrigin: protectionState.eventOrigin.screen.rawValue), includeAppVersionParameter: false) } let completionToken = ContentBlocking.shared.contentBlockingManager.scheduleCompilation() diff --git a/DuckDuckGo/Statistics/PixelEvent.swift b/DuckDuckGo/Statistics/PixelEvent.swift index d0fb923493..fbd2e641b0 100644 --- a/DuckDuckGo/Statistics/PixelEvent.swift +++ b/DuckDuckGo/Statistics/PixelEvent.swift @@ -153,6 +153,10 @@ extension Pixel { case duckPlayerSettingNever case duckPlayerSettingBackToDefault + // Dashboard + case dashboardProtectionAllowlistAdd(triggerOrigin: String?) + case dashboardProtectionAllowlistRemove(triggerOrigin: String?) + // Network Protection Waitlist case networkProtectionWaitlistUserActive case networkProtectionWaitlistEntryPointMenuItemDisplayed @@ -430,6 +434,11 @@ extension Pixel.Event { case .duckPlayerSettingBackToDefault: return "m_mac_duck-player_setting_back-to-default" + case .dashboardProtectionAllowlistAdd(let triggerOrigin): + return "m_mac_mp_wla" + case .dashboardProtectionAllowlistRemove(let triggerOrigin): + return "m_mac_mp_wlr" + case .launchInitial: return "m.mac.first-launch" case .serpInitial: diff --git a/DuckDuckGo/Statistics/PixelParameters.swift b/DuckDuckGo/Statistics/PixelParameters.swift index 642a598223..323d167d9c 100644 --- a/DuckDuckGo/Statistics/PixelParameters.swift +++ b/DuckDuckGo/Statistics/PixelParameters.swift @@ -52,6 +52,14 @@ extension Pixel.Event { case .dailyPixel(let pixel, isFirst: _): return pixel.parameters + case .dashboardProtectionAllowlistAdd(let triggerOrigin): + guard let trigger = triggerOrigin else { return nil } + return [PixelKit.Parameters.dashboardTriggerOrigin: trigger] + + case .dashboardProtectionAllowlistRemove(let triggerOrigin): + guard let trigger = triggerOrigin else { return nil } + return [PixelKit.Parameters.dashboardTriggerOrigin: trigger] + // Don't use default to force new items to be thought about case .crash, .brokenSiteReport, diff --git a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift index 6d5d65c57d..e3ab83f59d 100644 --- a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift +++ b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift @@ -53,6 +53,9 @@ public extension PixelKit { // Pixel experiments public static let experimentCohort = "cohort" + + // Dashboard + public static let dashboardTriggerOrigin = "trigger_origin" } enum Values { From d9f09a123f3b6f1616ebe0b28b858f3b65bf0ec2 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Mon, 23 Oct 2023 11:58:39 +0100 Subject: [PATCH 2/3] latest version --- .../xcshareddata/swiftpm/Package.resolved | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3e650a07ff..51bfa94e89 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -15,7 +15,7 @@ "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { "branch" : "shane/form-updates", - "revision" : "10298bbd53fb60d865b2b0f8738994eadc1697a7" + "revision" : "551ca5660aaae481ab770f892a742c70cfc0583c" } }, { @@ -77,7 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/privacy-dashboard", "state" : { - "revision" : "f505d33c24568af44b770aaa60d64ff1564de9dc" + "revision" : "b4ac92a444e79d5651930482623b9f6dc9265667", + "version" : "2.0.0" } }, { @@ -128,7 +129,7 @@ { "identity" : "trackerradarkit", "kind" : "remoteSourceControl", - "location" : "https://github.com/duckduckgo/TrackerRadarKit.git", + "location" : "https://github.com/duckduckgo/TrackerRadarKit", "state" : { "revision" : "4684440d03304e7638a2c8086895367e90987463", "version" : "1.2.1" From 6b3fdcfe95fb263a29d3141f5f6a625addde0245 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Mon, 23 Oct 2023 12:46:35 +0100 Subject: [PATCH 3/3] updated to released version of BSK --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- LocalPackages/Account/Package.swift | 2 +- LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 2d53adf592..f0bb59186e 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -14066,8 +14066,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { - branch = "shane/form-updates"; - kind = branch; + kind = exactVersion; + version = 82.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 51bfa94e89..1ef0f69712 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" : { - "branch" : "shane/form-updates", - "revision" : "551ca5660aaae481ab770f892a742c70cfc0583c" + "revision" : "dd595d952e0076a7a01d086ed2424838dcd985af", + "version" : "82.0.0" } }, { diff --git a/LocalPackages/Account/Package.swift b/LocalPackages/Account/Package.swift index e27d552c00..7a4c46bace 100644 --- a/LocalPackages/Account/Package.swift +++ b/LocalPackages/Account/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["Account"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "81.5.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "82.0.0"), .package(path: "../Purchase") ], targets: [ diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 9b64c6775e..345b7ae606 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: "81.5.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "82.0.0"), .package(path: "../PixelKit"), .package(path: "../SwiftUIExtensions") ], diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 5283f115be..301424ba96 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -31,7 +31,7 @@ let package = Package( .library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "81.5.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "82.0.0"), .package(path: "../XPCHelper"), .package(path: "../SwiftUIExtensions") ],