Skip to content

Commit

Permalink
BSK v146.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
federicocappelli committed May 22, 2024
1 parent 17dfc80 commit e463080
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down
15 changes: 9 additions & 6 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -502,7 +506,7 @@ import WebKit

private func stopTunnelAndShowThankYouMessagingIfNeeded() {

if AppDependencyProvider.shared.accountManager.isUserAuthenticated {
if accountManager.isUserAuthenticated {
tunnelDefaults.vpnEarlyAccessOverAlertAlreadyShown = true
return
}
Expand All @@ -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")
}
Expand All @@ -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
}
Expand All @@ -548,7 +552,7 @@ import WebKit
DailyPixel.fire(pixel: .privacyProSubscriptionActive)
}
}
await AppDependencyProvider.shared.accountManager.fetchEntitlements(cachePolicy: .reloadIgnoringLocalCacheData)
await accountManager.fetchEntitlements(cachePolicy: .reloadIgnoringLocalCacheData)
}
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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, *) {
Expand Down

0 comments on commit e463080

Please sign in to comment.