Skip to content

Commit

Permalink
dashboard updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Oct 19, 2023
1 parent 729d023 commit 4ed29ad
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14338,8 +14338,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 81.4.0;
branch = "shane/form-updates";
kind = branch;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "4cf8e857cd78e15c64ba37839634970fc675947c",
"version" : "81.4.0"
"branch" : "shane/form-updates",
"revision" : "7184e09228bdc6fba213e9d8ec109ec0f3c58f40"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "254b23cf292140498650421bb31fd05740f4579b",
"version" : "4.40.0"
"revision" : "aa279a3b006a0b1e009707311283c7fcaed24fb7",
"version" : "4.39.0"
}
},
{
Expand Down Expand Up @@ -77,8 +77,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "51e2b46f413bf3ef18afefad631ca70f2c25ef70",
"version" : "1.4.0"
"revision" : "f505d33c24568af44b770aaa60d64ff1564de9dc"
}
},
{
Expand Down Expand Up @@ -129,7 +128,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))
} else {
configuration.userDisabledProtection(forDomain: domain)
Pixel.fire(.dashboardProtectionAllowlistAdd(triggerOrigin: protectionState.eventOrigin.screen.rawValue))
}

let completionToken = ContentBlocking.shared.contentBlockingManager.scheduleCompilation()
Expand Down
11 changes: 11 additions & 0 deletions DuckDuckGo/Statistics/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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 @@ -445,6 +449,13 @@ extension Pixel.Event {
return "m_mac_duck-player_setting_never"
case .duckPlayerSettingBackToDefault:

Check failure on line 450 in DuckDuckGo/Statistics/PixelEvent.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Duplicate sets of conditions in the same branch instruction should be avoided (duplicate_conditions)
return "m_mac_duck-player_setting_back-to-default"
case .duckPlayerSettingBackToDefault:

Check failure on line 452 in DuckDuckGo/Statistics/PixelEvent.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Duplicate sets of conditions in the same branch instruction should be avoided (duplicate_conditions)
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"
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
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

0 comments on commit 4ed29ad

Please sign in to comment.