Skip to content

Commit

Permalink
Pixels name and param aligned with mac/win
Browse files Browse the repository at this point in the history
  • Loading branch information
federicocappelli committed Nov 17, 2023
1 parent 30ce95f commit 6a9b35e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
17 changes: 8 additions & 9 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ extension Pixel {
case forgetAllDataCleared

case privacyDashboardOpened
case privacyDashboardProtectionDisabled
case privacyDashboardProtectionEnabled
case reportBrokenSiteProtectionDisabled
case reportBrokenSiteProtectionEnabled

case dashboardProtectionAllowlistAdd
case dashboardProtectionAllowlistRemove

case privacyDashboardReportBrokenSite
case privacyDashboardPixelFromJS(rawPixel: String)

Expand Down Expand Up @@ -531,11 +531,10 @@ extension Pixel.Event {
case .forgetAllDataCleared: return "mf_dc"

case .privacyDashboardOpened: return "mp"

case .privacyDashboardProtectionDisabled: return "mp_wla"
case .privacyDashboardProtectionEnabled: return "mp_wlr"
case .reportBrokenSiteProtectionDisabled: return "m_broken_site_allowlist_add"
case .reportBrokenSiteProtectionEnabled: return "m_broken_site_allowlist_remove"

case .dashboardProtectionAllowlistAdd: return "mp_wla"
case .dashboardProtectionAllowlistRemove: return "mp_wlr"

case .privacyDashboardReportBrokenSite: return "mp_rb"
case .privacyDashboardPixelFromJS(let rawPixel): return rawPixel

Expand Down
14 changes: 4 additions & 10 deletions DuckDuckGo/PrivacyDashboard/PrivacyDashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,23 @@ class PrivacyDashboardViewController: UIViewController {
privacyDashboardController.didFinishRulesCompilation()
privacyDashboardController.updatePrivacyInfo(privacyInfo)
}

private func privacyDashboardProtectionSwitchChangeHandler(state: ProtectionState) {
guard let domain = privacyDashboardController.privacyInfo?.url.host else { return }

let privacyConfiguration = privacyConfigurationManager.privacyConfig

let pixelParam = ["trigger_origin": state.eventOrigin.screen.rawValue]
if state.isProtected {
privacyConfiguration.userEnabledProtection(forDomain: domain)
ActionMessageView.present(message: UserText.messageProtectionEnabled.format(arguments: domain))
Pixel.fire(pixel: .dashboardProtectionAllowlistRemove, withAdditionalParameters: pixelParam)
} else {
privacyConfiguration.userDisabledProtection(forDomain: domain)
ActionMessageView.present(message: UserText.messageProtectionDisabled.format(arguments: domain))
Pixel.fire(pixel: .dashboardProtectionAllowlistAdd, withAdditionalParameters: pixelParam)
}

contentBlockingManager.scheduleCompilation()

privacyDashboardController.didStartRulesCompilation()
switch source {
case .menu:
Pixel.fire(pixel: state.isProtected ? .reportBrokenSiteProtectionEnabled : .reportBrokenSiteProtectionDisabled)
case .dashboard:
Pixel.fire(pixel: state.isProtected ? .privacyDashboardProtectionEnabled : .privacyDashboardProtectionDisabled)
}
}

private func privacyDashboardCloseHandler() {
Expand Down

0 comments on commit 6a9b35e

Please sign in to comment.