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

Add VPN redemption retry event #2409

Merged
merged 5 commits into from
Jan 30, 2024
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: 2 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ extension Pixel {
case networkProtectionWaitlistTermsAccepted
case networkProtectionWaitlistNotificationShown
case networkProtectionWaitlistNotificationLaunched
case networkProtectionWaitlistRetriedInviteCodeRedemption

case networkProtectionGeoswitchingOpened
case networkProtectionGeoswitchingSetNearest
Expand Down Expand Up @@ -835,6 +836,7 @@ extension Pixel.Event {
case .networkProtectionWaitlistTermsAccepted: return "m_netp_waitlist_terms_accepted"
case .networkProtectionWaitlistNotificationShown: return "m_netp_waitlist_notification_shown"
case .networkProtectionWaitlistNotificationLaunched: return "m_netp_waitlist_notification_launched"
case .networkProtectionWaitlistRetriedInviteCodeRedemption: return "m_netp_waitlist_retried_invite_code_redemption"

case .networkProtectionGeoswitchingOpened: return "m_netp_imp_geoswitching"
case .networkProtectionGeoswitchingSetNearest: return "m_netp_ev_geoswitching_set_nearest"
Expand Down
14 changes: 13 additions & 1 deletion DuckDuckGo/AppDelegate+Waitlists.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ extension AppDelegate {
let tokenStore = NetworkProtectionKeychainTokenStore()
let waitlistStorage = VPNWaitlist.shared.waitlistStorage
if let inviteCode = waitlistStorage.getWaitlistInviteCode(), !tokenStore.isFeatureActivated {
let pixel: Pixel.Event = .networkProtectionWaitlistRetriedInviteCodeRedemption

do {
if let token = try tokenStore.fetchToken() {
DailyPixel.fireDailyAndCount(pixel: pixel, withAdditionalParameters: [ "tokenState": "found" ])
} else {
DailyPixel.fireDailyAndCount(pixel: pixel, withAdditionalParameters: [ "tokenState": "nil" ])
}
} catch {
DailyPixel.fireDailyAndCount(pixel: pixel, error: error, withAdditionalParameters: [ "tokenState": "error" ])
}

self?.fetchVPNWaitlistAuthToken(inviteCode: inviteCode)
}
}
Expand Down Expand Up @@ -96,7 +108,7 @@ extension AppDelegate {
try await NetworkProtectionCodeRedemptionCoordinator().redeem(inviteCode)
VPNWaitlist.shared.sendInviteCodeAvailableNotification()

DailyPixel.fire(pixel: .networkProtectionWaitlistNotificationShown)
DailyPixel.fireDailyAndCount(pixel: .networkProtectionWaitlistNotificationShown)
} catch {}
}
}
Expand Down
Loading