diff --git a/DuckDuckGo/Application/AppDelegate.swift b/DuckDuckGo/Application/AppDelegate.swift index 4043d747f2..6c332649a0 100644 --- a/DuckDuckGo/Application/AppDelegate.swift +++ b/DuckDuckGo/Application/AppDelegate.swift @@ -377,10 +377,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate { dataBrokerProtectionSubscriptionEventHandler.registerForSubscriptionAccountManagerEvents() - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(accountManager: subscriptionManager.accountManager, - freemiumPIRUserState: freemiumPIRUserState) + freemiumPIRUserStateManager: freemiumPIRUserStateManager) DataBrokerProtectionAppEvents(featureGatekeeper: pirGatekeeper).applicationDidFinishLaunching() @@ -429,10 +429,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate { NetworkProtectionAppEvents(featureGatekeeper: DefaultVPNFeatureGatekeeper(subscriptionManager: subscriptionManager)).applicationDidBecomeActive() - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) let pirGatekeeper = DefaultDataBrokerProtectionFeatureGatekeeper(accountManager: subscriptionManager.accountManager, - freemiumPIRUserState: freemiumPIRUserState) + freemiumPIRUserStateManager: freemiumPIRUserStateManager) DataBrokerProtectionAppEvents(featureGatekeeper: pirGatekeeper).applicationDidBecomeActive() diff --git a/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift b/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift index 62c7b00012..fea47cee1f 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift @@ -35,7 +35,7 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature private let userDefaults: UserDefaults private let subscriptionAvailability: SubscriptionFeatureAvailability private let accountManager: AccountManager - private let freemiumPIRUserState: FreemiumPIRUserState + private let freemiumPIRUserStateManager: FreemiumPIRUserStateManager init(privacyConfigurationManager: PrivacyConfigurationManaging = ContentBlocking.shared.privacyConfigurationManager, featureDisabler: DataBrokerProtectionFeatureDisabling = DataBrokerProtectionFeatureDisabler(), @@ -43,14 +43,14 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature userDefaults: UserDefaults = .standard, subscriptionAvailability: SubscriptionFeatureAvailability = DefaultSubscriptionFeatureAvailability(), accountManager: AccountManager, - freemiumPIRUserState: FreemiumPIRUserState) { + freemiumPIRUserStateManager: FreemiumPIRUserStateManager) { self.privacyConfigurationManager = privacyConfigurationManager self.featureDisabler = featureDisabler self.pixelHandler = pixelHandler self.userDefaults = userDefaults self.subscriptionAvailability = subscriptionAvailability self.accountManager = accountManager - self.freemiumPIRUserState = freemiumPIRUserState + self.freemiumPIRUserStateManager = freemiumPIRUserStateManager } var isUserLocaleAllowed: Bool { @@ -86,7 +86,7 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature /// - Returns: Bool indicating prerequisites are satisfied func arePrerequisitesSatisfied() async -> Bool { - if freemiumPIRUserState.isActiveUser { return true } + if freemiumPIRUserStateManager.isActiveUser { return true } let entitlements = await accountManager.hasEntitlement(forProductName: .dataBrokerProtection, cachePolicy: .reloadIgnoringLocalCacheData) diff --git a/DuckDuckGo/Freemium/FreemiumDebugMenu.swift b/DuckDuckGo/Freemium/FreemiumDebugMenu.swift index ab5f0474ed..7e46510a4f 100644 --- a/DuckDuckGo/Freemium/FreemiumDebugMenu.swift +++ b/DuckDuckGo/Freemium/FreemiumDebugMenu.swift @@ -42,11 +42,11 @@ final class FreemiumDebugMenu: NSMenuItem { @objc func setFreemiumPIROnboardStateEnabled() { - DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: Application.appDelegate.subscriptionManager.accountManager).didOnboard = true + DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: Application.appDelegate.subscriptionManager.accountManager).didOnboard = true } @objc func setFreemiumPIROnboardStateDisabled() { - DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: Application.appDelegate.subscriptionManager.accountManager).didOnboard = false + DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: Application.appDelegate.subscriptionManager.accountManager).didOnboard = false } } diff --git a/DuckDuckGo/HomePage/View/HomePageViewController.swift b/DuckDuckGo/HomePage/View/HomePageViewController.swift index dfdffe8968..16bd86647b 100644 --- a/DuckDuckGo/HomePage/View/HomePageViewController.swift +++ b/DuckDuckGo/HomePage/View/HomePageViewController.swift @@ -33,7 +33,7 @@ final class HomePageViewController: NSViewController { private let fireViewModel: FireViewModel private let onboardingViewModel: OnboardingViewModel private let freemiumPIRFeature: FreemiumPIRFeature - private var freemiumPIRUserState: FreemiumPIRUserState + private var freemiumPIRUserStateManager: FreemiumPIRUserStateManager private let freemiumPIRPresenter: FreemiumPIRPresenter private(set) lazy var faviconsFetcherOnboarding: FaviconsFetcherOnboarding? = { @@ -70,7 +70,7 @@ final class HomePageViewController: NSViewController { appearancePreferences: AppearancePreferences = AppearancePreferences.shared, defaultBrowserPreferences: DefaultBrowserPreferences = DefaultBrowserPreferences.shared, freemiumPIRFeature: FreemiumPIRFeature, - freemiumPIRUserState: FreemiumPIRUserState, + freemiumPIRUserStateManager: FreemiumPIRUserStateManager, freemiumPIRPresenter: FreemiumPIRPresenter = DefaultFreemiumPIRPresenter()) { self.tabCollectionViewModel = tabCollectionViewModel @@ -82,7 +82,7 @@ final class HomePageViewController: NSViewController { self.appearancePreferences = appearancePreferences self.defaultBrowserPreferences = defaultBrowserPreferences self.freemiumPIRFeature = freemiumPIRFeature - self.freemiumPIRUserState = freemiumPIRUserState + self.freemiumPIRUserStateManager = freemiumPIRUserStateManager self.freemiumPIRPresenter = freemiumPIRPresenter super.init(nibName: nil, bundle: nil) @@ -218,9 +218,9 @@ final class HomePageViewController: NSViewController { private func createPromotionModel() -> PromotionViewModel { return PromotionViewModel.freemiumPIRPromotion { [weak self] in // TODO: Remove this - self?.freemiumPIRUserState.didOnboard = true + self?.freemiumPIRUserStateManager.didOnboard = true // ------ - self?.freemiumPIRPresenter.showFreemiumPIR(didOnboard: self?.freemiumPIRUserState.didOnboard ?? false, + self?.freemiumPIRPresenter.showFreemiumPIR(didOnboard: self?.freemiumPIRUserStateManager.didOnboard ?? false, windowControllerManager: WindowControllersManager.shared) self?.appearancePreferences.didDismissHomePagePromotion = true } closeAction: { [weak self] in diff --git a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift index a830985e4e..4ff01bd32e 100644 --- a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift +++ b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift @@ -59,7 +59,7 @@ final class MoreOptionsMenu: NSMenu { private lazy var sharingMenu: NSMenu = SharingMenu(title: UserText.shareMenuItem) private var accountManager: AccountManager { subscriptionManager.accountManager } private let subscriptionManager: SubscriptionManager - private var freemiumPIRUserState: FreemiumPIRUserState + private var freemiumPIRUserStateManager: FreemiumPIRUserStateManager private let freemiumPIRFeature: FreemiumPIRFeature private let freemiumPIRPresenter: FreemiumPIRPresenter private let appearancePreferences: AppearancePreferences @@ -79,7 +79,7 @@ final class MoreOptionsMenu: NSMenu { sharingMenu: NSMenu? = nil, internalUserDecider: InternalUserDecider, subscriptionManager: SubscriptionManager, - freemiumPIRUserState: FreemiumPIRUserState, + freemiumPIRUserStateManager: FreemiumPIRUserStateManager, freemiumPIRFeature: FreemiumPIRFeature, freemiumPIRPresenter: FreemiumPIRPresenter = DefaultFreemiumPIRPresenter(), appearancePreferences: AppearancePreferences = .shared) { @@ -91,7 +91,7 @@ final class MoreOptionsMenu: NSMenu { self.subscriptionFeatureAvailability = subscriptionFeatureAvailability self.internalUserDecider = internalUserDecider self.subscriptionManager = subscriptionManager - self.freemiumPIRUserState = freemiumPIRUserState + self.freemiumPIRUserStateManager = freemiumPIRUserStateManager self.freemiumPIRFeature = freemiumPIRFeature self.freemiumPIRPresenter = freemiumPIRPresenter self.appearancePreferences = appearancePreferences @@ -261,9 +261,9 @@ final class MoreOptionsMenu: NSMenu { @objc func openFreemiumPIR(_ sender: NSMenuItem) { // TODO: Remove this - freemiumPIRUserState.didOnboard = true + freemiumPIRUserStateManager.didOnboard = true // ------ - freemiumPIRPresenter.showFreemiumPIR(didOnboard: freemiumPIRUserState.didOnboard, windowControllerManager: WindowControllersManager.shared) + freemiumPIRPresenter.showFreemiumPIR(didOnboard: freemiumPIRUserStateManager.didOnboard, windowControllerManager: WindowControllersManager.shared) appearancePreferences.isHomePagePromotionVisible = false } diff --git a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift index f8df8c580d..de5af94bd6 100644 --- a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift +++ b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift @@ -272,14 +272,14 @@ final class NavigationBarViewController: NSViewController { @IBAction func optionsButtonAction(_ sender: NSButton) { let internalUserDecider = NSApp.delegateTyped.internalUserDecider - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) let freemiumPIRFeature = DefaultFreemiumPIRFeature(subscriptionManager: subscriptionManager, accountManager: subscriptionManager.accountManager) let menu = MoreOptionsMenu(tabCollectionViewModel: tabCollectionViewModel, passwordManagerCoordinator: PasswordManagerCoordinator.shared, vpnFeatureGatekeeper: DefaultVPNFeatureGatekeeper(subscriptionManager: subscriptionManager), internalUserDecider: internalUserDecider, subscriptionManager: subscriptionManager, - freemiumPIRUserState: freemiumPIRUserState, + freemiumPIRUserStateManager: freemiumPIRUserStateManager, freemiumPIRFeature: freemiumPIRFeature) menu.actionDelegate = self diff --git a/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift b/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift index 33c0f09473..21298d2df7 100644 --- a/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift +++ b/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift @@ -137,7 +137,7 @@ final class RemoteMessagingConfigMatcherProvider: RemoteMessagingConfigMatcherPr let deprecatedRemoteMessageStorage = DefaultSurveyRemoteMessagingStorage.surveys() - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) return RemoteMessagingConfigMatcher( appAttributeMatcher: AppAttributeMatcher(statisticsStore: statisticsStore, @@ -164,7 +164,7 @@ final class RemoteMessagingConfigMatcherProvider: RemoteMessagingConfigMatcherPr hasCustomHomePage: startupPreferencesPersistor().launchToCustomHomePage, isDuckPlayerOnboarded: duckPlayerPreferencesPersistor.youtubeOverlayAnyButtonPressed, isDuckPlayerEnabled: duckPlayerPreferencesPersistor.duckPlayerModeBool != false, - isCurrentFreemiumPIRUser: freemiumPIRUserState.isActiveUser, + isCurrentFreemiumPIRUser: freemiumPIRUserStateManager.isActiveUser, dismissedDeprecatedMacRemoteMessageIds: deprecatedRemoteMessageStorage.dismissedMessageIDs() ), percentileStore: RemoteMessagingPercentileUserDefaultsStore(keyValueStore: UserDefaults.standard), diff --git a/DuckDuckGo/Tab/View/BrowserTabViewController.swift b/DuckDuckGo/Tab/View/BrowserTabViewController.swift index 2739fee59c..06502beee9 100644 --- a/DuckDuckGo/Tab/View/BrowserTabViewController.swift +++ b/DuckDuckGo/Tab/View/BrowserTabViewController.swift @@ -676,10 +676,10 @@ final class BrowserTabViewController: NSViewController { return homePageViewController ?? { let subscriptionManager = Application.appDelegate.subscriptionManager let freemiumPIRFeature = DefaultFreemiumPIRFeature(subscriptionManager: subscriptionManager, accountManager: subscriptionManager.accountManager) - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: subscriptionManager.accountManager) let homePageViewController = HomePageViewController(tabCollectionViewModel: tabCollectionViewModel, bookmarkManager: bookmarkManager, freemiumPIRFeature: freemiumPIRFeature, - freemiumPIRUserState: freemiumPIRUserState) + freemiumPIRUserStateManager: freemiumPIRUserStateManager) self.homePageViewController = homePageViewController return homePageViewController }() diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift index 3886ec0718..0e085fac9a 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift @@ -75,13 +75,13 @@ public class DataBrokerProtectionAgentManagerProvider { emailService: emailService, captchaService: captchaService) - let freemiumPIRUserState = DefaultFreemiumPIRUserState(userDefaults: .dbp, accountManager: accountManager) + let freemiumPIRUserStateManager = DefaultFreemiumPIRUserStateManager(userDefaults: .dbp, accountManager: accountManager) let agentstopper = DefaultDataBrokerProtectionAgentStopper(dataManager: dataManager, entitlementMonitor: DataBrokerProtectionEntitlementMonitor(), authenticationManager: authenticationManager, pixelHandler: pixelHandler, - freemiumPIRUserState: freemiumPIRUserState) + freemiumPIRUserStateManager: freemiumPIRUserStateManager) let operationDependencies = DefaultDataBrokerOperationDependencies( database: dataManager.database, @@ -100,7 +100,7 @@ public class DataBrokerProtectionAgentManagerProvider { operationDependencies: operationDependencies, pixelHandler: pixelHandler, agentStopper: agentstopper, - freemiumPIRUserState: freemiumPIRUserState) + freemiumPIRUserStateManager: freemiumPIRUserStateManager) } } @@ -114,7 +114,7 @@ public final class DataBrokerProtectionAgentManager { private let operationDependencies: DataBrokerOperationDependencies private let pixelHandler: EventMapping private let agentStopper: DataBrokerProtectionAgentStopper - private let freemiumPIRUserState: FreemiumPIRUserState + private let freemiumPIRUserStateManager: FreemiumPIRUserStateManager // Used for debug functions only, so not injected private lazy var browserWindowManager = BrowserWindowManager() @@ -129,7 +129,7 @@ public final class DataBrokerProtectionAgentManager { operationDependencies: DataBrokerOperationDependencies, pixelHandler: EventMapping, agentStopper: DataBrokerProtectionAgentStopper, - freemiumPIRUserState: FreemiumPIRUserState + freemiumPIRUserStateManager: FreemiumPIRUserStateManager ) { self.userNotificationService = userNotificationService self.activityScheduler = activityScheduler @@ -139,7 +139,7 @@ public final class DataBrokerProtectionAgentManager { self.operationDependencies = operationDependencies self.pixelHandler = pixelHandler self.agentStopper = agentStopper - self.freemiumPIRUserState = freemiumPIRUserState + self.freemiumPIRUserStateManager = freemiumPIRUserStateManager self.activityScheduler.delegate = self self.ipcServer.serverDelegate = self @@ -197,7 +197,7 @@ private extension DataBrokerProtectionAgentManager { func startFreemiumOrSubscriptionScheduledOperations(showWebView: Bool, operationDependencies: DataBrokerOperationDependencies, completion: ((DataBrokerProtectionAgentErrorCollection?) -> Void)?) { - if freemiumPIRUserState.isActiveUser { + if freemiumPIRUserStateManager.isActiveUser { queueManager.startScheduledScanOperationsIfPermitted(showWebView: showWebView, operationDependencies: operationDependencies, completion: completion) } else { queueManager.startScheduledAllOperationsIfPermitted(showWebView: showWebView, operationDependencies: operationDependencies, completion: completion) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift index 2f9dda5796..8012ad94cc 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift @@ -21,7 +21,7 @@ import Common import Freemium protocol DataBrokerProtectionAgentStopper { - /// Validates if the user has is an active freemium user, OR if they have profile data, is authenticated, and has valid entitlement. If any of these conditions are not met, the agent will be stopped. + /// Validates if the user is an active freemium user, OR if they have profile data, is authenticated, and has valid entitlement. If any of these conditions are not met, the agent will be stopped. func validateRunPrerequisitesAndStopAgentIfNecessary() async /// Monitors the entitlement package. If the entitlement check returns false, and the user is NOT an active freemium user, the agent will be stopped. @@ -35,20 +35,20 @@ struct DefaultDataBrokerProtectionAgentStopper: DataBrokerProtectionAgentStopper private let authenticationManager: DataBrokerProtectionAuthenticationManaging private let pixelHandler: EventMapping private let stopAction: DataProtectionStopAction - private let freemiumPIRUserState: FreemiumPIRUserState + private let freemiumPIRUserStateManager: FreemiumPIRUserStateManager init(dataManager: DataBrokerProtectionDataManaging, entitlementMonitor: DataBrokerProtectionEntitlementMonitoring, authenticationManager: DataBrokerProtectionAuthenticationManaging, pixelHandler: EventMapping, stopAction: DataProtectionStopAction = DefaultDataProtectionStopAction(), - freemiumPIRUserState: FreemiumPIRUserState) { + freemiumPIRUserStateManager: FreemiumPIRUserStateManager) { self.dataManager = dataManager self.entitlementMonitor = entitlementMonitor self.authenticationManager = authenticationManager self.pixelHandler = pixelHandler self.stopAction = stopAction - self.freemiumPIRUserState = freemiumPIRUserState + self.freemiumPIRUserStateManager = freemiumPIRUserStateManager } /// Checks PIR prerequisites and stops the agent if necessary @@ -61,7 +61,7 @@ struct DefaultDataBrokerProtectionAgentStopper: DataBrokerProtectionAgentStopper do { let hasProfile = try dataManager.fetchProfile() != nil let isAuthenticated = authenticationManager.isUserAuthenticated - let isFreemium = freemiumPIRUserState.isActiveUser + let isFreemium = freemiumPIRUserStateManager.isActiveUser if !hasProfile || (!isAuthenticated && !isFreemium) { os_log("Prerequisites are invalid", log: .dataBrokerProtection) @@ -86,7 +86,7 @@ struct DefaultDataBrokerProtectionAgentStopper: DataBrokerProtectionAgentStopper public func monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: TimeInterval) { entitlementMonitor.start(checkEntitlementFunction: authenticationManager.hasValidEntitlement, interval: interval) { result in - guard !self.freemiumPIRUserState.isActiveUser else { return } + guard !self.freemiumPIRUserStateManager.isActiveUser else { return } stopAgentBasedOnEntitlementCheckResult(result) } } diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerExecutionConfigTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerExecutionConfigTests.swift index f4fd38c78a..1ed238590a 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerExecutionConfigTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerExecutionConfigTests.swift @@ -30,7 +30,7 @@ final class DataBrokerExecutionConfigTests: XCTestCase { XCTAssertEqual(value, expectedValue) } - func testWhenOperationIsScheduledScans_thenConcurrentOperationsBetweenBrokersIsSix() { + func testWhenOperationIsScheduledScans_thenConcurrentOperationsBetweenBrokersIsTwo() { let value = sut.concurrentOperationsFor(.scheduledScan) let expectedValue = 2 XCTAssertEqual(value, expectedValue) diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift index f851abad45..8f79b47a55 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift @@ -82,7 +82,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = false @@ -121,7 +121,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = true @@ -156,7 +156,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { entitlementMonitor: DataBrokerProtectionEntitlementMonitor(), authenticationManager: MockAuthenticationManager(), pixelHandler: mockPixelHandler, - stopAction: mockStopAction, freemiumPIRUserState: MockFreemiumPIRUserState()) + stopAction: mockStopAction, freemiumPIRUserStateManager: MockFreemiumPIRUserState()) sut = DataBrokerProtectionAgentManager( userNotificationService: mockNotificationService, activityScheduler: mockActivityScheduler, @@ -166,7 +166,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: agentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = nil mockFreemiumPIRUserState.isActiveUser = true @@ -200,7 +200,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = nil @@ -238,7 +238,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = false @@ -266,7 +266,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = true @@ -294,7 +294,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = false @@ -322,7 +322,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockDataManager.profileToReturn = mockProfile mockFreemiumPIRUserState.isActiveUser = true @@ -350,7 +350,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockNotificationService.reset() @@ -372,7 +372,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockNotificationService.reset() @@ -394,7 +394,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockNotificationService.reset() mockQueueManager.startImmediateScanOperationsIfPermittedCompletionError = DataBrokerProtectionAgentErrorCollection(oneTimeError: NSError(domain: "test", code: 10)) @@ -417,7 +417,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockNotificationService.reset() mockDataManager.shouldReturnHasMatches = true @@ -440,7 +440,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockNotificationService.reset() mockDataManager.shouldReturnHasMatches = false @@ -463,7 +463,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockFreemiumPIRUserState.isActiveUser = false @@ -490,7 +490,7 @@ final class DataBrokerProtectionAgentManagerTests: XCTestCase { operationDependencies: mockDependencies, pixelHandler: mockPixelHandler, agentStopper: mockAgentStopper, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) mockFreemiumPIRUserState.isActiveUser = true diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentStopperTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentStopperTests.swift index f99d547808..a605d74d6d 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentStopperTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentStopperTests.swift @@ -70,7 +70,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -87,7 +87,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -104,7 +104,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -121,7 +121,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -138,7 +138,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -155,7 +155,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertFalse(mockStopAction.wasStopCalled) @@ -172,7 +172,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -189,7 +189,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -206,7 +206,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertTrue(mockStopAction.wasStopCalled) @@ -223,7 +223,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertFalse(mockStopAction.wasStopCalled) @@ -239,7 +239,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertFalse(mockStopAction.wasStopCalled) @@ -256,7 +256,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertFalse(mockStopAction.wasStopCalled) @@ -273,7 +273,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) await stopper.validateRunPrerequisitesAndStopAgentIfNecessary() XCTAssertFalse(mockStopAction.wasStopCalled) @@ -290,7 +290,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) let expectation = XCTestExpectation(description: "Wait for monitor") stopper.monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: 0.1) @@ -314,7 +314,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) let expectation = XCTestExpectation(description: "Wait for monitor") stopper.monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: 0.1) @@ -338,7 +338,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) let expectation = XCTestExpectation(description: "Wait for monitor") stopper.monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: 0.1) @@ -362,7 +362,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) let expectation = XCTestExpectation(description: "Wait for monitor") stopper.monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: 0.1) @@ -385,7 +385,7 @@ final class DataBrokerProtectionAgentStopperTests: XCTestCase { authenticationManager: mockAuthenticationManager, pixelHandler: mockPixelHandler, stopAction: mockStopAction, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) let expectation = XCTestExpectation(description: "Wait for monitor") stopper.monitorEntitlementAndStopAgentIfEntitlementIsInvalidAndUserIsNotFreemium(interval: 0.1) diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift index a3051d6ff2..fccaf51383 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift @@ -1938,7 +1938,7 @@ struct MockMigrationsProvider: DataBrokerProtectionDatabaseMigrationsProvider { } } -final class MockFreemiumPIRUserState: FreemiumPIRUserState { +final class MockFreemiumPIRUserState: FreemiumPIRUserStateManager { var didOnboard = false var isActiveUser = false } diff --git a/LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserState.swift b/LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserStateManager.swift similarity index 86% rename from LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserState.swift rename to LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserStateManager.swift index e9cfc25a1d..315eab91b2 100644 --- a/LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserState.swift +++ b/LocalPackages/Freemium/Sources/Freemium/FreemiumPIRUserStateManager.swift @@ -1,5 +1,5 @@ // -// FreemiumPIRUserState.swift +// FreemiumPIRUserStateManager.swift // // Copyright © 2024 DuckDuckGo. All rights reserved. // @@ -19,16 +19,16 @@ import Foundation import Subscription -/// `FreemiumPIRUserState` types provide access to Freemium PIR-related state -public protocol FreemiumPIRUserState { +/// `FreemiumPIRUserStateManager` types provide access to Freemium PIR-related state +public protocol FreemiumPIRUserStateManager { var didOnboard: Bool { get set } /// `isActiveUser` implementations`should only return `true` if the current user DOES NOT have a subscription var isActiveUser: Bool { get } } -/// Default implementation of `FreemiumPIRUserState`. `UserDefaults` is used as underlying storage. -public final class DefaultFreemiumPIRUserState: FreemiumPIRUserState { +/// Default implementation of `FreemiumPIRUserStateManager`. `UserDefaults` is used as underlying storage. +public final class DefaultFreemiumPIRUserStateManager: FreemiumPIRUserStateManager { private enum Keys { static let didOnboard = "macos.browser.freemium.pir.did.onboard" diff --git a/LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateTests.swift b/LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateManagerTests.swift similarity index 79% rename from LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateTests.swift rename to LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateManagerTests.swift index c8543e0269..d17f2e0676 100644 --- a/LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateTests.swift +++ b/LocalPackages/Freemium/Tests/FreemiumTests/FreemiumPIRUserStateManagerTests.swift @@ -1,5 +1,5 @@ // -// FreemiumPIRUserStateTests.swift +// FreemiumPIRUserStateManagerTests.swift // // Copyright © 2024 DuckDuckGo. All rights reserved. // @@ -21,21 +21,21 @@ import XCTest import Subscription import SubscriptionTestingUtilities -final class FreemiumPIRUserStateTests: XCTestCase { +final class FreemiumPIRUserStateManagerTests: XCTestCase { private static let testSuiteName = "test.defaults.freemium.user.state.tests" private let pir = "macos.browser.freemium.pir.did.onboard" - private let testUserDefaults = UserDefaults(suiteName: FreemiumPIRUserStateTests.testSuiteName)! + private let testUserDefaults = UserDefaults(suiteName: FreemiumPIRUserStateManagerTests.testSuiteName)! private var mockAccountManager: AccountManagerMock! override func setUpWithError() throws { mockAccountManager = AccountManagerMock() - testUserDefaults.removePersistentDomain(forName: FreemiumPIRUserStateTests.testSuiteName) + testUserDefaults.removePersistentDomain(forName: FreemiumPIRUserStateManagerTests.testSuiteName) } func testSetsHasFreemiumPIR() throws { // Given - let sut = DefaultFreemiumPIRUserState(userDefaults: testUserDefaults, accountManager: mockAccountManager) + let sut = DefaultFreemiumPIRUserStateManager(userDefaults: testUserDefaults, accountManager: mockAccountManager) XCTAssertFalse(testUserDefaults.bool(forKey: pir)) // When @@ -47,7 +47,7 @@ final class FreemiumPIRUserStateTests: XCTestCase { func testGetsHasFreemiumPIR() throws { // Given - let sut = DefaultFreemiumPIRUserState(userDefaults: testUserDefaults, accountManager: mockAccountManager) + let sut = DefaultFreemiumPIRUserStateManager(userDefaults: testUserDefaults, accountManager: mockAccountManager) XCTAssertFalse(sut.didOnboard) testUserDefaults.setValue(true, forKey: pir) XCTAssertTrue(testUserDefaults.bool(forKey: pir)) @@ -61,7 +61,7 @@ final class FreemiumPIRUserStateTests: XCTestCase { func testIsCurrentFreemiumPIRUser_WhenDidOnboardIsTrueAndUserIsNotAuthenticated_ShouldReturnTrue() { // Given - let sut = DefaultFreemiumPIRUserState(userDefaults: testUserDefaults, accountManager: mockAccountManager) + let sut = DefaultFreemiumPIRUserStateManager(userDefaults: testUserDefaults, accountManager: mockAccountManager) XCTAssertFalse(sut.didOnboard) testUserDefaults.setValue(true, forKey: pir) mockAccountManager.accessToken = nil @@ -76,7 +76,7 @@ final class FreemiumPIRUserStateTests: XCTestCase { func testIsCurrentFreemiumPIRUser_WhenDidOnboardIsTrueAndUserIsAuthenticated_ShouldReturnFalse() { // Given - let sut = DefaultFreemiumPIRUserState(userDefaults: testUserDefaults, accountManager: mockAccountManager) + let sut = DefaultFreemiumPIRUserStateManager(userDefaults: testUserDefaults, accountManager: mockAccountManager) XCTAssertFalse(sut.didOnboard) testUserDefaults.setValue(true, forKey: pir) mockAccountManager.accessToken = "some_token" @@ -91,7 +91,7 @@ final class FreemiumPIRUserStateTests: XCTestCase { func testIsCurrentFreemiumPIRUser_WhenDidOnboardIsFalse_ShouldReturnFalse() { // Given - let sut = DefaultFreemiumPIRUserState(userDefaults: testUserDefaults, accountManager: mockAccountManager) + let sut = DefaultFreemiumPIRUserStateManager(userDefaults: testUserDefaults, accountManager: mockAccountManager) XCTAssertFalse(sut.didOnboard) testUserDefaults.setValue(false, forKey: pir) mockAccountManager.accessToken = "some_token" diff --git a/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift b/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift index 0d9dc9e49d..dd0f276105 100644 --- a/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift +++ b/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift @@ -50,7 +50,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() @@ -68,7 +68,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() @@ -86,7 +86,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() @@ -104,7 +104,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() @@ -122,7 +122,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() @@ -140,7 +140,7 @@ final class DataBrokerProtectionFeatureGatekeeperTests: XCTestCase { userDefaults: userDefaults(), subscriptionAvailability: mockFeatureAvailability, accountManager: mockAccountManager, - freemiumPIRUserState: mockFreemiumPIRUserState) + freemiumPIRUserStateManager: mockFreemiumPIRUserState) // When let result = await sut.arePrerequisitesSatisfied() diff --git a/UnitTests/Menus/MoreOptionsMenuTests.swift b/UnitTests/Menus/MoreOptionsMenuTests.swift index aa06d02224..775ae57226 100644 --- a/UnitTests/Menus/MoreOptionsMenuTests.swift +++ b/UnitTests/Menus/MoreOptionsMenuTests.swift @@ -92,7 +92,7 @@ final class MoreOptionsMenuTests: XCTestCase { sharingMenu: NSMenu(), internalUserDecider: internalUserDecider, subscriptionManager: subscriptionManager, - freemiumPIRUserState: mockFreemiumPIRUserState, + freemiumPIRUserStateManager: mockFreemiumPIRUserState, freemiumPIRFeature: freemiumPIRFeature, freemiumPIRPresenter: mockFreemiumPIRPresenter) diff --git a/UnitTests/RemoteMessaging/RemoteMessagingClientTests.swift b/UnitTests/RemoteMessaging/RemoteMessagingClientTests.swift index f6e357c572..2a8ed992bf 100644 --- a/UnitTests/RemoteMessaging/RemoteMessagingClientTests.swift +++ b/UnitTests/RemoteMessaging/RemoteMessagingClientTests.swift @@ -30,7 +30,7 @@ struct MockRemoteMessagingStoreProvider: RemoteMessagingStoreProviding { } } -struct MockFreemiumPIRUserState: FreemiumPIRUserState { +struct MockFreemiumPIRUserState: FreemiumPIRUserStateManager { var didOnboard = false var isActiveUser = false }