Skip to content

Commit

Permalink
[Release PR] Fix VPN internal user testing issues (#2665)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1206986434624665/f
Tech Design URL:
CC:

Description:

This PR cherry picks #2664 to the release branch.
  • Loading branch information
samsymons authored Apr 3, 2024
1 parent 8df8b81 commit 5b67fa4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

private func stopTunnelAndShowThankYouMessagingIfNeeded() {
if AccountManager().isUserAuthenticated {
tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown = true
return
}

if vpnFeatureVisibility.shouldShowThankYouMessaging() && !tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown {
presentVPNEarlyAccessOverAlert()

Task {
let controller = NetworkProtectionTunnelController()

if await controller.isConnected {
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled)
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled, withAdditionalParameters: [
"reason": "thank-you-dialog"
])
}

await controller.stop()
Expand Down
9 changes: 7 additions & 2 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,7 @@ class MainViewController: UIViewController {
@objc
private func onNetworkProtectionAccountSignIn(_ notification: Notification) {
tunnelDefaults.resetEntitlementMessaging()
tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown = true
os_log("[NetP Subscription] Reset expired entitlement messaging", log: .networkProtection, type: .info)
}

Expand All @@ -1435,7 +1436,9 @@ class MainViewController: UIViewController {
}

if await controller.isConnected {
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled)
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled, withAdditionalParameters: [
"reason": "entitlement-change"
])
}

await controller.stop()
Expand All @@ -1449,7 +1452,9 @@ class MainViewController: UIViewController {
let controller = NetworkProtectionTunnelController()

if await controller.isConnected {
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled)
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled, withAdditionalParameters: [
"reason": "account-signed-out"
])
}

await controller.stop()
Expand Down

0 comments on commit 5b67fa4

Please sign in to comment.