Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Privacy Dashboard updates #1757

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14067,7 +14067,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 81.5.0;
version = 82.0.0;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "c427dc63421c4b394f54c245de8e5665bcd6966a",
"version" : "81.5.0"
"revision" : "dd595d952e0076a7a01d086ed2424838dcd985af",
"version" : "82.0.0"
}
},
{
Expand Down Expand Up @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "51e2b46f413bf3ef18afefad631ca70f2c25ef70",
"version" : "1.4.0"
"revision" : "b4ac92a444e79d5651930482623b9f6dc9265667",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -129,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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions DuckDuckGo/Statistics/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions DuckDuckGo/Statistics/PixelParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/Account/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public extension PixelKit {

// Pixel experiments
public static let experimentCohort = "cohort"

// Dashboard
public static let dashboardTriggerOrigin = "trigger_origin"
}

enum Values {
Expand Down