Skip to content

Commit

Permalink
Fix VPN internal user bugs (#2664)
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 fixes an issue where the VPN Thank You modal was interrupting the setup flow.
  • Loading branch information
samsymons committed Apr 3, 2024
1 parent 8df8b81 commit 740b321
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 740b321

Please sign in to comment.