Skip to content

Commit

Permalink
Add VPN redemption retry event (#2409)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1206472504459349/f
Tech Design URL:
CC:

Description:

This PR adds a pixel that sends when the VPN invite code retry logic kicks in.
  • Loading branch information
samsymons authored Jan 30, 2024
1 parent 3ba3de5 commit 636b6a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit 636b6a1

Please sign in to comment.