Skip to content

Commit

Permalink
Remove Privacy Pro from device once expired account is deleted (#2922)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1200019156869587/1207492658883345/f

**Description**:
When fetching subscription info a 401 response means that the token is
no longer valid. As a result we should sign out the user.
  • Loading branch information
miasma13 authored Jun 30, 2024
1 parent 85881d9 commit 8255ffd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13042,7 +13042,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 163.0.1;
version = 164.0.0;
};
};
9FF521422BAA8FF300B9819B /* 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" : {
"revision" : "39e10c8eeddeb03750350597bd55fd8c43b5fd83",
"version" : "163.0.1"
"revision" : "be669f88c20b862b43e6267004c45022447209ee",
"version" : "164.0.0"
}
},
{
Expand Down
12 changes: 6 additions & 6 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
syncService?.initializeIfNeeded()
syncService?.scheduler.notifyAppLifecycleEvent()

subscriptionManager.updateSubscriptionStatus { isActive in
if isActive {
PixelKit.fire(PrivacyProPixel.privacyProSubscriptionActive, frequency: .daily)
}
}

NetworkProtectionAppEvents(featureGatekeeper: DefaultVPNFeatureGatekeeper(subscriptionManager: subscriptionManager)).applicationDidBecomeActive()

#if DBP
Expand All @@ -393,6 +387,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

AppPrivacyFeatures.shared.contentBlocking.privacyConfigurationManager.toggleProtectionsCounter.sendEventsIfNeeded()

subscriptionManager.refreshCachedSubscriptionAndEntitlements { isSubscriptionActive in
if isSubscriptionActive {
PixelKit.fire(PrivacyProPixel.privacyProSubscriptionActive, frequency: .daily)
}
}

Task { @MainActor in
await vpnRedditSessionWorkaround.installRedditSessionWorkaround()
}
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "163.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "163.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "163.0.1"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "164.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
3 changes: 0 additions & 3 deletions UnitTests/DBP/Mocks/DataBrokerProtectionMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ final class MockAccountManager: AccountManager {
.success(AccountDetails(email: "", externalID: ""))
}

func refreshSubscriptionAndEntitlements() async {
}

func checkForEntitlements(wait waitTime: Double, retry retryCount: Int) async -> Bool {
true
}
Expand Down

0 comments on commit 8255ffd

Please sign in to comment.