Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription oauth api v2 #3580

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
88549ff
Initial auth v2 adoption
federicocappelli Nov 19, 2024
9b2e7ba
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 19, 2024
4fa2b0a
DI done
federicocappelli Nov 20, 2024
0d333af
token v1/v2 exchange fixed, token providing improved
federicocappelli Nov 22, 2024
b79e8eb
new log
federicocappelli Nov 22, 2024
18b8fe6
tokencontainer codable
federicocappelli Nov 22, 2024
e6cc664
vpn token propagation
federicocappelli Nov 25, 2024
00c4cbc
more logs
federicocappelli Nov 25, 2024
4bcc286
keychain type unification
federicocappelli Nov 25, 2024
875e880
keychain fix
federicocappelli Nov 25, 2024
92014b4
init improvements
federicocappelli Nov 26, 2024
8dc4078
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 26, 2024
09eee50
codablehelper
federicocappelli Nov 26, 2024
ffb9ecd
it works!
federicocappelli Nov 26, 2024
dcccf44
fixing unit tests
federicocappelli Nov 27, 2024
6ddece0
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 27, 2024
62ddb64
unit tests fixes
federicocappelli Nov 28, 2024
975d8ac
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 28, 2024
a121c06
unit tests fixed
federicocappelli Nov 29, 2024
d3e657c
BSK > branch
federicocappelli Nov 29, 2024
5ccd25b
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 29, 2024
08bf3f0
lint
federicocappelli Nov 29, 2024
1ef216e
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Nov 29, 2024
9032b69
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Dec 2, 2024
b5a3f43
unit tests improvments
federicocappelli Dec 2, 2024
6dc2e1f
varius
federicocappelli Dec 3, 2024
89b338a
work-ish
federicocappelli Dec 5, 2024
eda12c9
asd
federicocappelli Dec 5, 2024
b1a42fc
reverting minor changes
federicocappelli Dec 5, 2024
d77d465
Merge branch 'main' into fcappelli/vpn_error_2
federicocappelli Dec 5, 2024
97d1681
subscription purchase notification fixed
federicocappelli Dec 6, 2024
d313d32
unit tests fixes
federicocappelli Dec 6, 2024
584bc20
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Dec 6, 2024
7bad6bd
unit tests
federicocappelli Dec 6, 2024
828fd5f
lint and bsk update
federicocappelli Dec 6, 2024
22d9290
unit test fix
federicocappelli Dec 6, 2024
6f0aafb
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Dec 12, 2024
b21b30d
bsk update
federicocappelli Dec 12, 2024
8002ec0
bsk update
federicocappelli Dec 12, 2024
14ee67e
code cleanup
federicocappelli Dec 12, 2024
9f6d6f4
schema language reverted
federicocappelli Dec 12, 2024
ad293c9
background token refresh
federicocappelli Dec 13, 2024
d89f4a8
BSK update
federicocappelli Dec 13, 2024
e89f9a8
DBP cleanup
federicocappelli Dec 16, 2024
651d070
DBP logger added
federicocappelli Dec 16, 2024
3a6fec1
DBP fix
federicocappelli Dec 16, 2024
5e66674
BSK update
federicocappelli Dec 16, 2024
647123b
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 6, 2025
fac05ef
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 7, 2025
39adf17
TestUtils removed from BSK
federicocappelli Jan 7, 2025
a0d5a7a
BSK update and lint
federicocappelli Jan 7, 2025
a1bfa12
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 9, 2025
107fe1e
restore sub final web page display fixed
federicocappelli Jan 9, 2025
4924945
first stage of fixing the VPN
federicocappelli Jan 10, 2025
1518416
subscription signout notification parametrised
federicocappelli Jan 10, 2025
01038cf
debug crash temp fixed
federicocappelli Jan 10, 2025
0098e5c
subscription manager initial data load improved, pixels added
federicocappelli Jan 12, 2025
358ea03
lint
federicocappelli Jan 12, 2025
9eaf062
subscription cache bug fix
federicocappelli Jan 13, 2025
c77e374
bug fixing
federicocappelli Jan 14, 2025
d321469
some changes requested in the PR
federicocappelli Jan 14, 2025
a2470eb
pr changes
federicocappelli Jan 14, 2025
d0ca705
pixels added
federicocappelli Jan 14, 2025
39b30fc
cleanup
federicocappelli Jan 14, 2025
de72420
settings subscription status logic improved
federicocappelli Jan 14, 2025
c29989b
legacy token support implemented in VPN, migration improved
federicocappelli Jan 15, 2025
ca8f251
pr comments addressed
federicocappelli Jan 15, 2025
f737f2d
bsk updated
federicocappelli Jan 16, 2025
21f3732
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 16, 2025
4d2d595
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 20, 2025
7284019
Subscription stuff renamed
federicocappelli Jan 20, 2025
e5ec1bd
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 20, 2025
e98529a
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 20, 2025
bbde6d6
BSK updated
federicocappelli Jan 20, 2025
f11debc
Merge branch 'main' into fcappelli/subscription_oauth_api_v2
federicocappelli Jan 20, 2025
f3a5d24
BSK update
federicocappelli Jan 21, 2025
445fe07
Tunnel controller now refreshes the token after passing it to the VPN
federicocappelli Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 49 additions & 115 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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" : "d1275238d88f25cd31a29be2b4f20bbba5de9aa1",
"version" : "226.0.0"
"branch" : "fcappelli/subscription_oauth_api_v2",
"revision" : "0eebb62e9ecc995185ea1c79c31318d50d05ba40"
}
},
{
Expand Down Expand Up @@ -72,6 +72,15 @@
"version" : "6.0.1"
}
},
{
"identity" : "jwt-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/jwt-kit.git",
"state" : {
"revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a",
"version" : "4.13.4"
}
},
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -135,6 +144,24 @@
"version" : "1.4.0"
}
},
{
"identity" : "swift-asn1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-asn1.git",
"state" : {
"revision" : "ae33e5941bb88d88538d0a6b19ca0b01e6c76dcf",
"version" : "1.3.1"
}
},
{
"identity" : "swift-crypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "ff0f781cf7c6a22d52957e50b104f5768b50c779",
"version" : "3.10.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
Expand Down
64 changes: 64 additions & 0 deletions DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Unit Tests.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA585D8F248FD31400E9A3E2"
BuildableName = "Unit Tests.xctest"
BlueprintName = "Unit Tests"
ReferencedContainer = "container:DuckDuckGo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA585D7D248FD31100E9A3E2"
BuildableName = "DuckDuckGo.app"
BlueprintName = "DuckDuckGo Privacy Browser"
ReferencedContainer = "container:DuckDuckGo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
42 changes: 22 additions & 20 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
let remoteMessagingClient: RemoteMessagingClient!
let onboardingStateMachine: ContextualOnboardingStateMachine & ContextualOnboardingStateUpdater

public let subscriptionManager: SubscriptionManager
public let subscriptionManager: any SubscriptionManager
public let subscriptionUIHandler: SubscriptionUIHandling
private let subscriptionCookieManager: SubscriptionCookieManaging
private var subscriptionCookieManagerFeatureFlagCancellable: AnyCancellable?
Expand All @@ -133,9 +133,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: - DBP

private lazy var dataBrokerProtectionSubscriptionEventHandler: DataBrokerProtectionSubscriptionEventHandler = {
let authManager = DataBrokerAuthenticationManagerBuilder.buildAuthenticationManager(subscriptionManager: subscriptionManager)
let authenticationManager = DataBrokerProtectionAuthenticationManager(
subscriptionManager: subscriptionManager)
return DataBrokerProtectionSubscriptionEventHandler(featureDisabler: DataBrokerProtectionFeatureDisabler(),
authenticationManager: authManager,
authenticationManager: authenticationManager,
pixelHandler: DataBrokerProtectionPixelsHandler())
}()

Expand All @@ -152,7 +153,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
)

return VPNRedditSessionWorkaround(
accountManager: subscriptionManager.accountManager,
subscriptionManager: subscriptionManager,
ipcClient: ipcClient,
statusReporter: statusReporter
)
Expand Down Expand Up @@ -292,8 +293,16 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

onboardingStateMachine = ContextualOnboardingStateMachine()

// Configure Subscription
subscriptionManager = DefaultSubscriptionManager(featureFlagger: featureFlagger)
// MARK: - Subscription configuration
let subscriptionAppGroup = Bundle.main.appGroup(bundle: .subs)
let subscriptionUserDefaults = UserDefaults(suiteName: subscriptionAppGroup)!
let subscriptionEnvironment = DefaultSubscriptionManager.getSavedOrDefaultEnvironment(userDefaults: subscriptionUserDefaults)
subscriptionManager = DefaultSubscriptionManager(keychainType: .dataProtection(.named(subscriptionAppGroup)),
environment: subscriptionEnvironment,
userDefaults: subscriptionUserDefaults,
canPerformAuthMigration: true,
canHandlePixels: true)

subscriptionUIHandler = SubscriptionUIHandler(windowControllersManagerProvider: {
return WindowControllersManager.shared
})
Expand All @@ -302,6 +311,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
WKHTTPCookieStoreWrapper(store: WKWebsiteDataStore.default().httpCookieStore)
}, eventMapping: SubscriptionCookieManageEventPixelMapping())

// MARK: -

// Update VPN environment and match the Subscription environment
vpnSettings.alignTo(subscriptionEnvironment: subscriptionManager.currentEnvironment)

Expand All @@ -321,7 +332,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
freemiumDBPFeature = DefaultFreemiumDBPFeature(privacyConfigurationManager: ContentBlocking.shared.privacyConfigurationManager,
experimentManager: experimentManager,
subscriptionManager: subscriptionManager,
accountManager: subscriptionManager.accountManager,
freemiumDBPUserStateManager: freemiumDBPUserStateManager)
freemiumDBPPromotionViewCoordinator = FreemiumDBPPromotionViewCoordinator(freemiumDBPUserStateManager: freemiumDBPUserStateManager,
freemiumDBPFeature: freemiumDBPFeature)
Expand Down Expand Up @@ -406,8 +416,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

startupSync()

subscriptionManager.loadInitialData()

let privacyConfigurationManager = ContentBlocking.shared.privacyConfigurationManager

// Enable subscriptionCookieManager if feature flag is present
Expand Down Expand Up @@ -481,8 +489,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
dataBrokerProtectionSubscriptionEventHandler.registerForSubscriptionAccountManagerEvents()

let freemiumDBPUserStateManager = DefaultFreemiumDBPUserStateManager(userDefaults: .dbp)
let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(accountManager:
subscriptionManager.accountManager,
let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(subscriptionManager: subscriptionManager,
freemiumDBPUserStateManager: freemiumDBPUserStateManager)

DataBrokerProtectionAppEvents(featureGatekeeper: pirGatekeeper).applicationDidFinishLaunching()
Expand Down Expand Up @@ -539,23 +546,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
NetworkProtectionAppEvents(featureGatekeeper: DefaultVPNFeatureGatekeeper(subscriptionManager: subscriptionManager)).applicationDidBecomeActive()

let freemiumDBPUserStateManager = DefaultFreemiumDBPUserStateManager(userDefaults: .dbp)
let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(accountManager:
subscriptionManager.accountManager,
let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(subscriptionManager: subscriptionManager,
freemiumDBPUserStateManager: freemiumDBPUserStateManager)

DataBrokerProtectionAppEvents(featureGatekeeper: pirGatekeeper).applicationDidBecomeActive()

subscriptionManager.refreshCachedSubscriptionAndEntitlements { isSubscriptionActive in
if isSubscriptionActive {
PixelKit.fire(PrivacyProPixel.privacyProSubscriptionActive, frequency: .daily)
}
// Subscription initial tasks
Task {
await subscriptionManager.loadInitialData()
}

Task { @MainActor in
await vpnRedditSessionWorkaround.installRedditSessionWorkaround()
}

Task { @MainActor in
await subscriptionCookieManager.refreshSubscriptionCookie()
}
}
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/Configuration/ConfigurationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ final class ConfigurationManager: DefaultConfigurationManager {
do {
try await task.value
didFetchAnyTrackerBlockingDependencies = true
} catch APIRequest.Error.invalidStatusCode(304) {
tryAgainSoon()
} catch {
Logger.config.error(
"Failed to complete configuration update to \(configuration.rawValue, privacy: .public): \(error.localizedDescription, privacy: .public)"
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/DBP/DataBrokerPrerequisitesStatusVerifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Foundation
import Combine
import DataBrokerProtection
import LoginItems
import os.log

enum DataBrokerPrerequisitesStatus {
case invalidDirectory
Expand All @@ -40,10 +41,13 @@ final class DefaultDataBrokerPrerequisitesStatusVerifier: DataBrokerPrerequisite

func checkStatus() -> DataBrokerPrerequisitesStatus {
if !statusChecker.doesHaveNecessaryPermissions() {
Logger.dataBrokerProtection.log("Invalid system permissions")
return .invalidSystemPermission
} else if !statusChecker.isInCorrectDirectory() {
Logger.dataBrokerProtection.log("Invalid directory")
return .invalidDirectory
} else {
Logger.dataBrokerProtection.log("Valid system permissions")
return .valid
}
}
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/DBP/DataBrokerProtectionAppEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Foundation
import LoginItems
import Common
import DataBrokerProtection
import os.log

struct DataBrokerProtectionAppEvents {

Expand Down Expand Up @@ -52,6 +53,7 @@ struct DataBrokerProtectionAppEvents {
// In this case, let's disable the agent and delete any left-over data because there's nothing for it to do
if let profileQueriesCount = try? DataBrokerProtectionManager.shared.dataManager.profileQueriesCount(),
profileQueriesCount > 0 {
Logger.dataBrokerProtection.log("Found \(profileQueriesCount) profile queries in DB. Restarting agent.")
restartBackgroundAgent(loginItemsManager: loginItemsManager)

// Wait to make sure the agent has had time to restart before attempting to call a method on it
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
}

@objc private func runCustomJSON() {
let authenticationManager = DataBrokerAuthenticationManagerBuilder.buildAuthenticationManager(subscriptionManager: Application.appDelegate.subscriptionManager)
let authenticationManager = DataBrokerProtectionAuthenticationManager(
subscriptionManager: Application.appDelegate.subscriptionManager)
let viewController = DataBrokerRunCustomJSONViewController(authenticationManager: authenticationManager)
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 500, height: 400),
styleMask: [.titled, .closable, .miniaturizable, .resizable],
Expand Down
26 changes: 8 additions & 18 deletions DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature
private let pixelHandler: EventMapping<DataBrokerProtectionPixels>
private let userDefaults: UserDefaults
private let subscriptionAvailability: SubscriptionFeatureAvailability
private let accountManager: AccountManager
private let subscriptionManager: any SubscriptionManager
private let freemiumDBPUserStateManager: FreemiumDBPUserStateManager

init(privacyConfigurationManager: PrivacyConfigurationManaging = ContentBlocking.shared.privacyConfigurationManager,
featureDisabler: DataBrokerProtectionFeatureDisabling = DataBrokerProtectionFeatureDisabler(),
pixelHandler: EventMapping<DataBrokerProtectionPixels> = DataBrokerProtectionPixelsHandler(),
userDefaults: UserDefaults = .standard,
subscriptionAvailability: SubscriptionFeatureAvailability = DefaultSubscriptionFeatureAvailability(),
accountManager: AccountManager,
subscriptionManager: any SubscriptionManager,
freemiumDBPUserStateManager: FreemiumDBPUserStateManager) {
self.privacyConfigurationManager = privacyConfigurationManager
self.featureDisabler = featureDisabler
self.pixelHandler = pixelHandler
self.userDefaults = userDefaults
self.subscriptionAvailability = subscriptionAvailability
self.accountManager = accountManager
self.subscriptionManager = subscriptionManager
self.freemiumDBPUserStateManager = freemiumDBPUserStateManager
}

Expand Down Expand Up @@ -80,28 +80,18 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature

/// Checks DBP prerequisites
///
/// Prerequisites are satisified if either:
/// Prerequisites are satisfied if either:
/// 1. The user is an active freemium user (e.g has activated freemium and is not authenticated)
/// 2. The user has a subscription with valid entitlements
///
/// - Returns: Bool indicating prerequisites are satisfied
func arePrerequisitesSatisfied() async -> Bool {

let isAuthenticated = accountManager.isUserAuthenticated
let isAuthenticated = subscriptionManager.isUserAuthenticated
if !isAuthenticated && freemiumDBPUserStateManager.didActivate { return true }

let entitlements = await accountManager.hasEntitlement(forProductName: .dataBrokerProtection,
cachePolicy: .reloadIgnoringLocalCacheData)
var hasEntitlements: Bool
switch entitlements {
case .success(let value):
hasEntitlements = value
case .failure:
hasEntitlements = false
}

let hasEntitlements = await subscriptionManager.isFeatureAvailableForUser(.dataBrokerProtection)
firePrerequisitePixelsAndLogIfNecessary(hasEntitlements: hasEntitlements, isAuthenticatedResult: isAuthenticated)

return hasEntitlements && isAuthenticated
}
}
Expand All @@ -114,11 +104,11 @@ private extension DefaultDataBrokerProtectionFeatureGatekeeper {

func firePrerequisitePixelsAndLogIfNecessary(hasEntitlements: Bool, isAuthenticatedResult: Bool) {
if !hasEntitlements {
Logger.dataBrokerProtection.error("DBP feature Gatekeeper: Entitlement check failed")
Logger.dataBrokerProtection.log("DBP feature Gatekeeper: No Entitlements available")
}

if !isAuthenticatedResult {
Logger.dataBrokerProtection.error("DBP feature Gatekeeper: Authentication check failed")
Logger.dataBrokerProtection.log("DBP feature Gatekeeper: Authentication check failed")
}
}
}
9 changes: 4 additions & 5 deletions DuckDuckGo/DBP/DataBrokerProtectionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public final class DataBrokerProtectionManager {

private lazy var freemiumDBPFirstProfileSavedNotifier: FreemiumDBPFirstProfileSavedNotifier = {
let freemiumDBPUserStateManager = DefaultFreemiumDBPUserStateManager(userDefaults: .dbp)
let accountManager = Application.appDelegate.subscriptionManager.accountManager
let freemiumDBPFirstProfileSavedNotifier = FreemiumDBPFirstProfileSavedNotifier(freemiumDBPUserStateManager: freemiumDBPUserStateManager,
accountManager: accountManager)
return freemiumDBPFirstProfileSavedNotifier
return FreemiumDBPFirstProfileSavedNotifier(freemiumDBPUserStateManager: freemiumDBPUserStateManager,
subscriptionManager: Application.appDelegate.subscriptionManager)
}()

lazy var dataManager: DataBrokerProtectionDataManager = {
Expand All @@ -57,7 +55,8 @@ public final class DataBrokerProtectionManager {
}()

private init() {
self.authenticationManager = DataBrokerAuthenticationManagerBuilder.buildAuthenticationManager(subscriptionManager: Application.appDelegate.subscriptionManager)
self.authenticationManager = DataBrokerProtectionAuthenticationManager(
subscriptionManager: Application.appDelegate.subscriptionManager)
}

public func isUserAuthenticated() -> Bool {
Expand Down
Loading