From e4630809a4a431fd0454a79562cb0120de9b00d5 Mon Sep 17 00:00:00 2001 From: Federico Cappelli Date: Wed, 22 May 2024 23:31:19 +0100 Subject: [PATCH] BSK v146.0.0 --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- DuckDuckGo/AppDelegate.swift | 15 +++++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 30ba8172d3..6d498896b3 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -9873,8 +9873,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { - branch = fcappelli/subscription_refactoring_2; - kind = branch; + kind = exactVersion; + version = 146.0.0; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 31a1df66ce..3a2023b938 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { - "branch" : "fcappelli/subscription_refactoring_2", - "revision" : "874ae4269db821797742655e134e72199c2813c8" + "revision" : "b01a7ba359b650f0c5c3ab00a756e298b1ae650c", + "version" : "146.0.0" } }, { diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index 178a9ebda7..bfcea59ff4 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -88,6 +88,10 @@ import WebKit @UserDefaultsWrapper(key: .privacyConfigCustomURL, defaultValue: nil) private var privacyConfigCustomURL: String? + var accountManager: AccountManaging { + AppDependencyProvider.shared.accountManager + } + // swiftlint:disable:next function_body_length cyclomatic_complexity func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { @@ -502,7 +506,7 @@ import WebKit private func stopTunnelAndShowThankYouMessagingIfNeeded() { - if AppDependencyProvider.shared.accountManager.isUserAuthenticated { + if accountManager.isUserAuthenticated { tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown = true return } @@ -513,7 +517,7 @@ import WebKit await self.stopAndRemoveVPN(with: "thank-you-dialog") } } else if AppDependencyProvider.shared.vpnFeatureVisibility.isPrivacyProLaunched() - && !AppDependencyProvider.shared.accountManager.isUserAuthenticated { + && !accountManager.isUserAuthenticated { Task { await self.stopAndRemoveVPN(with: "subscription-check") } @@ -538,7 +542,7 @@ import WebKit func updateSubscriptionStatus() { Task { - guard let token = AppDependencyProvider.shared.accountManager.accessToken else { return } + guard let token = accountManager.accessToken else { return } var subscriptionService: SubscriptionService { AppDependencyProvider.shared.subscriptionManager.subscriptionService } @@ -548,7 +552,7 @@ import WebKit DailyPixel.fire(pixel: .privacyProSubscriptionActive) } } - await AppDependencyProvider.shared.accountManager.fetchEntitlements(cachePolicy: .reloadIgnoringLocalCacheData) + await accountManager.fetchEntitlements(cachePolicy: .reloadIgnoringLocalCacheData) } } @@ -893,7 +897,7 @@ import WebKit return } - if case .success(true) = await AccountManager().hasEntitlement(for: .networkProtection, cachePolicy: .returnCacheDataDontLoad) { + if case .success(true) = await accountManager.hasEntitlement(for: .networkProtection, cachePolicy: .returnCacheDataDontLoad) { let items = [ UIApplicationShortcutItem(type: ShortcutKey.openVPNSettings, localizedTitle: UserText.netPOpenVPNQuickAction, @@ -988,7 +992,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate { func presentNetworkProtectionStatusSettingsModal() { Task { - let accountManager = AppDependencyProvider.shared.accountManager if case .success(let hasEntitlements) = await accountManager.hasEntitlement(for: .networkProtection), hasEntitlements { if #available(iOS 15, *) {