Skip to content

Commit

Permalink
Update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo committed Mar 27, 2024
1 parent c2d7cd4 commit c69c902
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#if NETWORK_PROTECTION
widgetRefreshModel.refreshVPNWidget()

if vpnFeatureVisibility.shouldShowThankYouMessaging() {
stopTunnelAndShowThankYouMessagingIfNeeded()
}
stopTunnelAndShowThankYouMessagingIfNeeded()

if tunnelDefaults.showEntitlementAlert {
presentExpiredEntitlementAlert()
Expand All @@ -514,20 +512,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

private func stopTunnelAndShowThankYouMessagingIfNeeded() {
Task {
let controller = NetworkProtectionTunnelController()
if vpnFeatureVisibility.shouldShowThankYouMessaging() && !tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown {
presentVPNEarlyAccessOverAlert()

if await controller.isConnected {
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled)
}
Task {
let controller = NetworkProtectionTunnelController()

await controller.stop()
await controller.removeVPN()

if !tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown {
await MainActor.run {
self.presentVPNEarlyAccessOverAlert()
if await controller.isConnected {
DailyPixel.fireDailyAndCount(pixel: .privacyProVPNBetaStoppedWhenPrivacyProEnabled)
}

await controller.stop()
await controller.removeVPN()
}
}
}
Expand Down

0 comments on commit c69c902

Please sign in to comment.