Skip to content

Commit

Permalink
subscription pixels refined
Browse files Browse the repository at this point in the history
  • Loading branch information
federicocappelli committed Mar 21, 2024
1 parent cb3b645 commit 77db822
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ final class MoreOptionsMenu: NSMenu {

#if SUBSCRIPTION
@objc func openSubscriptionPurchasePage(_ sender: NSMenuItem) {
Pixel.fire(.privacyProOfferScreenImpression)
actionDelegate?.optionsButtonMenuRequestedSubscriptionPurchasePage(self)
}

Expand Down
5 changes: 1 addition & 4 deletions DuckDuckGo/Tab/UserScripts/SubscriptionPagesUserScript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,6 @@ final class SubscriptionPagesUseSubscriptionFeature: Subfeature {
if isBackendError {
DailyPixel.fire(pixel: .privacyProPurchaseFailureBackendError, frequency: .dailyAndCount)
}

if subscriptionActivationError != .hasActiveSubscription && subscriptionActivationError != .cancelledByUser {
DailyPixel.fire(pixel: .privacyProPurchaseFailure, frequency: .dailyAndCount)
}
}

func activateSubscription(params: Any, original: WKScriptMessage) async throws -> Encodable? {
Expand Down Expand Up @@ -577,6 +573,7 @@ extension MainWindowController {

@MainActor
func showSomethingWentWrongAlert() {
DailyPixel.fire(pixel: .privacyProPurchaseFailure, frequency: .dailyAndCount)
guard let window else { return }

window.show(.somethingWentWrongAlert())
Expand Down
11 changes: 11 additions & 0 deletions DuckDuckGo/Windows/View/WindowControllersManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ extension WindowControllersManager {
}

func showTab(with content: Tab.TabContent) {

reportTabOpening(with: content)

guard let windowController = self.mainWindowController else {
let tabCollection = TabCollection(tabs: [Tab(content: content)])
let tabCollectionViewModel = TabCollectionViewModel(tabCollection: tabCollection)
Expand All @@ -198,6 +201,14 @@ extension WindowControllersManager {
windowController.window?.orderFront(nil)
}

func reportTabOpening(with content: Tab.TabContent) {
switch content {
case .subscription(let uRL):

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Test (Non-Sandbox)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Test (Sandbox)

immutable value 'uRL' was never used; consider replacing with '_' or removing it

Check warning on line 206 in DuckDuckGo/Windows/View/WindowControllersManager.swift

View workflow job for this annotation

GitHub Actions / Test (Sandbox)

immutable value 'uRL' was never used; consider replacing with '_' or removing it
Pixel.fire(.privacyProOfferScreenImpression)
default: break
}
}

// MARK: - VPN

#if NETWORK_PROTECTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public final class PreferencesSubscriptionModel: ObservableObject {

@MainActor
func removeFromThisDeviceAction() {
userEventHandler(.removeSubscriptionClick)
accountManager.signOut()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public struct PreferencesSubscriptionView: View {
}
})
Button(UserText.removeFromThisDeviceButton, action: {
model.userEventHandler(.removeSubscriptionClick)
showingRemoveConfirmationDialog.toggle()
})
} label: {
Expand Down Expand Up @@ -189,7 +188,6 @@ public struct PreferencesSubscriptionView: View {
.buttonStyle(DefaultActionButtonStyle(enabled: true))
Menu {
Button(UserText.removeFromThisDeviceButton, action: {
model.userEventHandler(.removeSubscriptionClick)
showingRemoveConfirmationDialog.toggle()
})
} label: {
Expand Down

0 comments on commit 77db822

Please sign in to comment.