diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index 92abe4c7ac..87dbdbce26 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -342,6 +342,7 @@ extension Pixel { case networkProtectionWaitlistTermsAccepted case networkProtectionWaitlistNotificationShown case networkProtectionWaitlistNotificationLaunched + case networkProtectionWaitlistRetriedInviteCodeRedemption case networkProtectionGeoswitchingOpened case networkProtectionGeoswitchingSetNearest @@ -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" diff --git a/DuckDuckGo/AppDelegate+Waitlists.swift b/DuckDuckGo/AppDelegate+Waitlists.swift index 9370756149..b377d170b7 100644 --- a/DuckDuckGo/AppDelegate+Waitlists.swift +++ b/DuckDuckGo/AppDelegate+Waitlists.swift @@ -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) } } @@ -96,7 +108,7 @@ extension AppDelegate { try await NetworkProtectionCodeRedemptionCoordinator().redeem(inviteCode) VPNWaitlist.shared.sendInviteCodeAvailableNotification() - DailyPixel.fire(pixel: .networkProtectionWaitlistNotificationShown) + DailyPixel.fireDailyAndCount(pixel: .networkProtectionWaitlistNotificationShown) } catch {} } }