From 740b321ecde9d158542e8bb0aeaeed27d91426ad Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Tue, 2 Apr 2024 18:57:09 -0700 Subject: [PATCH] Fix VPN internal user bugs (#2664) 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. --- DuckDuckGo/AppDelegate.swift | 9 ++++++++- DuckDuckGo/MainViewController.swift | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index 79240a52de..42def30fc4 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -512,6 +512,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } private func stopTunnelAndShowThankYouMessagingIfNeeded() { + if AccountManager().isUserAuthenticated { + tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown = true + return + } + if vpnFeatureVisibility.shouldShowThankYouMessaging() && !tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown { presentVPNEarlyAccessOverAlert() @@ -519,7 +524,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let controller = NetworkProtectionTunnelController() if await controller.isConnected { - DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled) + DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled, withAdditionalParameters: [ + "reason": "thank-you-dialog" + ]) } await controller.stop() diff --git a/DuckDuckGo/MainViewController.swift b/DuckDuckGo/MainViewController.swift index 4f555e1323..92c0277371 100644 --- a/DuckDuckGo/MainViewController.swift +++ b/DuckDuckGo/MainViewController.swift @@ -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) } @@ -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() @@ -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()