diff --git a/Configuration/BuildNumber.xcconfig b/Configuration/BuildNumber.xcconfig index b3f6d1dba0..1c3d661283 100644 --- a/Configuration/BuildNumber.xcconfig +++ b/Configuration/BuildNumber.xcconfig @@ -1 +1 @@ -CURRENT_PROJECT_VERSION = 337 +CURRENT_PROJECT_VERSION = 338 diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 99bc882cf5..1bd3805c74 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { "branch" : "fcappelli/subscription_oauth_api_v2", - "revision" : "d1998cae838ac33584b24c99662dd898e2eca0f0" + "revision" : "351dc80d2364cce863cc10c1ed753a55bbcca7a2" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/content-scope-scripts", "state" : { - "revision" : "bc808eb735d9eb72d5c54cf2452b104b6a370e25", - "version" : "6.43.0" + "revision" : "a539758027d9fd37d9d26213399ac156ca9fb81c", + "version" : "7.1.0" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/duckduckgo-autofill.git", "state" : { - "revision" : "88982a3802ac504e2f1a118a73bfdf2d8f4a7735", - "version" : "16.0.0" + "revision" : "47c26dc32b94cdbcef3e6157497147917678c25c", + "version" : "16.1.0" } }, { diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser App Store.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser App Store.xcscheme index ca4cde3131..a5d9608b24 100644 --- a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser App Store.xcscheme +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser App Store.xcscheme @@ -148,9 +148,6 @@ - - diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser.xcscheme index a68c110733..8a90105f09 100644 --- a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser.xcscheme +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo Privacy Browser.xcscheme @@ -180,9 +180,6 @@ - - diff --git a/DuckDuckGo/DBP/DBPHomeViewController.swift b/DuckDuckGo/DBP/DBPHomeViewController.swift index 96443a61f1..5b73cd4af3 100644 --- a/DuckDuckGo/DBP/DBPHomeViewController.swift +++ b/DuckDuckGo/DBP/DBPHomeViewController.swift @@ -52,7 +52,8 @@ final class DBPHomeViewController: NSViewController { passwordGeneration: false, inlineIconCredentials: false, thirdPartyCredentialsProvider: false, - unknownUsernameCategorization: false) + unknownUsernameCategorization: false, + partialFormSaves: false) let isGPCEnabled = WebTrackingProtectionPreferences.shared.isGPCEnabled let sessionKey = UUID().uuidString diff --git a/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift b/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift index a4e053b9d4..a0327bfbda 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift @@ -175,21 +175,21 @@ final class DataBrokerProtectionDebugMenu: NSMenu { } @objc private func startScheduledOperations(_ sender: NSMenuItem) { - Logger.dataBrokerProtection.debug("Running queued operations...") + Logger.dataBrokerProtection.log("Running queued operations...") let showWebView = sender.representedObject as? Bool ?? false DataBrokerProtectionManager.shared.loginItemInterface.startScheduledOperations(showWebView: showWebView) } @objc private func runScanOperations(_ sender: NSMenuItem) { - Logger.dataBrokerProtection.debug("Running scan operations...") + Logger.dataBrokerProtection.log("Running scan operations...") let showWebView = sender.representedObject as? Bool ?? false DataBrokerProtectionManager.shared.loginItemInterface.startImmediateOperations(showWebView: showWebView) } @objc private func runOptoutOperations(_ sender: NSMenuItem) { - Logger.dataBrokerProtection.debug("Running Optout operations...") + Logger.dataBrokerProtection.log("Running Optout operations...") let showWebView = sender.representedObject as? Bool ?? false DataBrokerProtectionManager.shared.loginItemInterface.runAllOptOuts(showWebView: showWebView) diff --git a/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift b/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift index 8f547c15d6..9856737f39 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionFeatureGatekeeper.swift @@ -75,7 +75,7 @@ struct DefaultDataBrokerProtectionFeatureGatekeeper: DataBrokerProtectionFeature func disableAndDeleteForAllUsers() { featureDisabler.disableAndDelete() - Logger.dataBrokerProtection.debug("Disabling and removing DBP for all users") + Logger.dataBrokerProtection.log("Disabling and removing DBP for all users") } /// Checks DBP prerequisites diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index c65a7fd000..b0bc789066 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -909,23 +909,6 @@ extension MainViewController { guard let internalUserDecider = NSApp.delegateTyped.internalUserDecider as? DefaultInternalUserDecider else { return } let state = internalUserDecider.isInternalUser internalUserDecider.debugSetInternalUserState(!state) - - if !DefaultSubscriptionFeatureAvailability().isFeatureAvailable { - // We only clear PPro state when it's not available, as otherwise - // there should be no state to clear. Clearing PPro state can - // trigger notifications which we want to avoid unless - // necessary. - clearPrivacyProState() - } - } - - /// Clears the PrivacyPro state to make testing easier. - /// - private func clearPrivacyProState() { - Task { - await Application.appDelegate.subscriptionManager.signOut() - UserDefaults.netP.networkProtectionEntitlementsExpired = false - } } @objc func resetDailyPixels(_ sender: Any?) { diff --git a/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift b/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift index 2ebc439811..65c5207f49 100644 --- a/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift +++ b/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift @@ -421,14 +421,13 @@ final class AddressBarTextField: NSTextField { } #endif - if DefaultSubscriptionFeatureAvailability().isFeatureAvailable { - let baseURL = Application.appDelegate.subscriptionManager.url(for: .baseURL) - let identityTheftRestorationURL = Application.appDelegate.subscriptionManager.url(for: .identityTheftRestoration) - if providedUrl.isChild(of: baseURL) || providedUrl.isChild(of: identityTheftRestorationURL) { - self.updateValue(selectedTabViewModel: nil, addressBarString: nil) // reset - self.window?.makeFirstResponder(nil) - return - } + // Prevent typing in subscription URLs directly in the address bar + let baseURL = Application.appDelegate.subscriptionManager.url(for: .baseURL) + let identityTheftRestorationURL = Application.appDelegate.subscriptionManager.url(for: .identityTheftRestoration) + if providedUrl.isChild(of: baseURL) || providedUrl.isChild(of: identityTheftRestorationURL) { + self.updateValue(selectedTabViewModel: nil, addressBarString: nil) // reset + self.window?.makeFirstResponder(nil) + return } self.window?.makeFirstResponder(nil) diff --git a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift index 1a588d1400..d02dea1927 100644 --- a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift +++ b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift @@ -418,8 +418,6 @@ final class MoreOptionsMenu: NSMenu, NSMenuDelegate { @MainActor private func addSubscriptionItems() { - guard subscriptionFeatureAvailability.isFeatureAvailable else { return } - func shouldHideDueToNoProduct() -> Bool { let platform = subscriptionManager.currentEnvironment.purchasePlatform return platform == .appStore && subscriptionManager.canPurchase == false @@ -968,7 +966,7 @@ final class SubscriptionSubMenu: NSMenu, NSMenuDelegate { } private func refreshAvailabilityBasedOnEntitlements() async { -// guard subscriptionFeatureAvailability.isFeatureAvailable, subscriptionManager.isUserAuthenticated else { return } + guard subscriptionManager.isUserAuthenticated else { return } let features = await subscriptionManager.currentSubscriptionFeatures(forceRefresh: false) let vpnFeature = features.first { $0.entitlement == .networkProtection } let dbpFeature = features.first { $0.entitlement == .dataBrokerProtection } diff --git a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift index bae89d39f1..14e2ebc92f 100644 --- a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift +++ b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift @@ -344,11 +344,9 @@ final class NavigationBarViewController: NSViewController { } private func toggleNetworkProtectionPopover() { - guard DefaultSubscriptionFeatureAvailability().isFeatureAvailable, - subscriptionManager.isUserAuthenticated else { + guard subscriptionManager.isUserAuthenticated else { return } - popovers.toggleNetworkProtectionPopover(from: networkProtectionButton, withDelegate: networkProtectionButtonModel) } diff --git a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift index 5d13537d59..93c7c44e5b 100644 --- a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift +++ b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift @@ -460,7 +460,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { let subscriptionManager = DefaultSubscriptionManager(oAuthClient: authClient, subscriptionEndpointService: subscriptionEndpointService, subscriptionEnvironment: subscriptionEnvironment, - subscriptionFeatureFlagger: nil, pixelHandler: pixelHandler) // MARK: - diff --git a/DuckDuckGo/Preferences/Model/PreferencesSection.swift b/DuckDuckGo/Preferences/Model/PreferencesSection.swift index 3c6de26132..f696f5f3a4 100644 --- a/DuckDuckGo/Preferences/Model/PreferencesSection.swift +++ b/DuckDuckGo/Preferences/Model/PreferencesSection.swift @@ -65,24 +65,22 @@ struct PreferencesSection: Hashable, Identifiable { .init(id: .about, panes: otherPanes) ] - if DefaultSubscriptionFeatureAvailability().isFeatureAvailable { - let subscriptionManager = Application.appDelegate.subscriptionManager - let platform = subscriptionManager.currentEnvironment.purchasePlatform - var shouldHidePrivacyProDueToNoProducts = platform == .appStore && subscriptionManager.canPurchase == false + let subscriptionManager = Application.appDelegate.subscriptionManager + let platform = subscriptionManager.currentEnvironment.purchasePlatform + var shouldHidePrivacyProDueToNoProducts = platform == .appStore && subscriptionManager.canPurchase == false - if subscriptionManager.isUserAuthenticated { - shouldHidePrivacyProDueToNoProducts = false - } - - if !shouldHidePrivacyProDueToNoProducts { - var subscriptionPanes: [PreferencePaneIdentifier] = [.subscription] + if subscriptionManager.isUserAuthenticated { + shouldHidePrivacyProDueToNoProducts = false + } - if includingVPN { - subscriptionPanes.append(.vpn) - } + if !shouldHidePrivacyProDueToNoProducts { + var subscriptionPanes: [PreferencePaneIdentifier] = [.subscription] - sections.insert(.init(id: .privacyPro, panes: subscriptionPanes), at: 1) + if includingVPN { + subscriptionPanes.append(.vpn) } + + sections.insert(.init(id: .privacyPro, panes: subscriptionPanes), at: 1) } return sections diff --git a/DuckDuckGo/Subscription/DefaultSubscriptionManager+StandardConfiguration.swift b/DuckDuckGo/Subscription/DefaultSubscriptionManager+StandardConfiguration.swift index f6256d02aa..39ffc73cc8 100644 --- a/DuckDuckGo/Subscription/DefaultSubscriptionManager+StandardConfiguration.swift +++ b/DuckDuckGo/Subscription/DefaultSubscriptionManager+StandardConfiguration.swift @@ -71,10 +71,6 @@ extension DefaultSubscriptionManager { } switch feature { - case .isLaunchedROW: - return featureFlagger.isFeatureOn(.isPrivacyProLaunchedROW) - case .isLaunchedROWOverride: - return featureFlagger.isFeatureOn(.isPrivacyProLaunchedROWOverride) case .usePrivacyProUSARegionOverride: return (featureFlagger.internalUserDecider.isInternalUser && environment.serviceEnvironment == .staging && @@ -98,13 +94,11 @@ extension DefaultSubscriptionManager { oAuthClient: authClient, subscriptionEndpointService: subscriptionEndpointService, subscriptionEnvironment: environment, - subscriptionFeatureFlagger: subscriptionFeatureFlagger, pixelHandler: pixelHandler) } else { self.init(oAuthClient: authClient, subscriptionEndpointService: subscriptionEndpointService, subscriptionEnvironment: environment, - subscriptionFeatureFlagger: subscriptionFeatureFlagger, pixelHandler: pixelHandler) } } diff --git a/DuckDuckGo/Subscription/SubscriptionManager+StandardConfiguration.swift b/DuckDuckGo/Subscription/SubscriptionManager+StandardConfiguration.swift new file mode 100644 index 0000000000..1b0896d1a4 --- /dev/null +++ b/DuckDuckGo/Subscription/SubscriptionManager+StandardConfiguration.swift @@ -0,0 +1,94 @@ +// +// SubscriptionManager+StandardConfiguration.swift +// +// Copyright © 2024 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation +import Subscription +import Common +import PixelKit +import BrowserServicesKit +import FeatureFlags + +extension DefaultSubscriptionManager { + + // Init the SubscriptionManager using the standard dependencies and configuration, to be used only in the dependencies tree root + public convenience init(featureFlagger: FeatureFlagger? = nil) { + // MARK: - Configure Subscription + let subscriptionAppGroup = Bundle.main.appGroup(bundle: .subs) + let subscriptionUserDefaults = UserDefaults(suiteName: subscriptionAppGroup)! + let subscriptionEnvironment = DefaultSubscriptionManager.getSavedOrDefaultEnvironment(userDefaults: subscriptionUserDefaults) + + let entitlementsCache = UserDefaultsCache<[Entitlement]>(userDefaults: subscriptionUserDefaults, + key: UserDefaultsCacheKey.subscriptionEntitlements, + settings: UserDefaultsCacheSettings(defaultExpirationInterval: .minutes(20))) + let accessTokenStorage = SubscriptionTokenKeychainStorage(keychainType: .dataProtection(.named(subscriptionAppGroup))) + let subscriptionEndpointService = DefaultSubscriptionEndpointService(currentServiceEnvironment: subscriptionEnvironment.serviceEnvironment) + let authEndpointService = DefaultAuthEndpointService(currentServiceEnvironment: subscriptionEnvironment.serviceEnvironment) + let subscriptionFeatureMappingCache = DefaultSubscriptionFeatureMappingCache(subscriptionEndpointService: subscriptionEndpointService, + userDefaults: subscriptionUserDefaults) + + let accountManager = DefaultAccountManager(accessTokenStorage: accessTokenStorage, + entitlementsCache: entitlementsCache, + subscriptionEndpointService: subscriptionEndpointService, + authEndpointService: authEndpointService) + + let subscriptionFeatureFlagger: FeatureFlaggerMapping = FeatureFlaggerMapping { feature in + guard let featureFlagger else { + // With no featureFlagger provided there is no gating of features + return feature.defaultState + } + + switch feature { + case .usePrivacyProUSARegionOverride: + return (featureFlagger.internalUserDecider.isInternalUser && + subscriptionEnvironment.serviceEnvironment == .staging && + subscriptionUserDefaults.storefrontRegionOverride == .usa) + case .usePrivacyProROWRegionOverride: + return (featureFlagger.internalUserDecider.isInternalUser && + subscriptionEnvironment.serviceEnvironment == .staging && + subscriptionUserDefaults.storefrontRegionOverride == .restOfWorld) + } + } + + if #available(macOS 12.0, *) { + let storePurchaseManager = DefaultStorePurchaseManager(subscriptionFeatureMappingCache: subscriptionFeatureMappingCache, + subscriptionFeatureFlagger: subscriptionFeatureFlagger) + self.init(storePurchaseManager: storePurchaseManager, + accountManager: accountManager, + subscriptionEndpointService: subscriptionEndpointService, + authEndpointService: authEndpointService, + subscriptionFeatureMappingCache: subscriptionFeatureMappingCache, + subscriptionEnvironment: subscriptionEnvironment) + } else { + self.init(accountManager: accountManager, + subscriptionEndpointService: subscriptionEndpointService, + authEndpointService: authEndpointService, + subscriptionFeatureMappingCache: subscriptionFeatureMappingCache, + subscriptionEnvironment: subscriptionEnvironment) + } + + accountManager.delegate = self + } +} + +extension DefaultSubscriptionManager: AccountManagerKeychainAccessDelegate { + + public func accountManagerKeychainAccessFailed(accessType: AccountKeychainAccessType, error: AccountKeychainAccessError) { + PixelKit.fire(PrivacyProErrorPixel.privacyProKeychainAccessError(accessType: accessType, accessError: error), + frequency: .legacyDailyAndCount) + } +} diff --git a/DuckDuckGo/Subscription/SubscriptionRedirectManager.swift b/DuckDuckGo/Subscription/SubscriptionRedirectManager.swift index 2a5bdfb4e4..8e946da48b 100644 --- a/DuckDuckGo/Subscription/SubscriptionRedirectManager.swift +++ b/DuckDuckGo/Subscription/SubscriptionRedirectManager.swift @@ -26,16 +26,13 @@ protocol SubscriptionRedirectManager: AnyObject { final class PrivacyProSubscriptionRedirectManager: SubscriptionRedirectManager { - private let featureAvailabiltyProvider: () -> Bool private let subscriptionEnvironment: SubscriptionEnvironment private let canPurchase: () -> Bool private let baseURL: URL - init(featureAvailabiltyProvider: @escaping @autoclosure () -> Bool = DefaultSubscriptionFeatureAvailability().isFeatureAvailable, - subscriptionEnvironment: SubscriptionEnvironment, + init(subscriptionEnvironment: SubscriptionEnvironment, baseURL: URL, canPurchase: @escaping () -> Bool) { - self.featureAvailabiltyProvider = featureAvailabiltyProvider self.subscriptionEnvironment = subscriptionEnvironment self.canPurchase = canPurchase self.baseURL = baseURL @@ -45,9 +42,8 @@ final class PrivacyProSubscriptionRedirectManager: SubscriptionRedirectManager { guard url.isPart(ofDomain: "duckduckgo.com") else { return nil } if url.pathComponents == URL.privacyPro.pathComponents { - let isFeatureAvailable = featureAvailabiltyProvider() let shouldHidePrivacyProDueToNoProducts = subscriptionEnvironment.purchasePlatform == .appStore && canPurchase() == false - let isPurchasePageRedirectActive = isFeatureAvailable && !shouldHidePrivacyProDueToNoProducts + let isPurchasePageRedirectActive = !shouldHidePrivacyProDueToNoProducts // Redirect the `/pro` URL to `/subscriptions` URL. If there are any query items in the original URL it appends to the `/subscriptions` URL. return isPurchasePageRedirectActive ? baseURL.addingQueryItems(from: url) : nil } diff --git a/DuckDuckGo/Tab/Model/ContentScopeFeatureFlagging.swift b/DuckDuckGo/Tab/Model/ContentScopeFeatureFlagging.swift index 09010c106e..c8ee45e224 100644 --- a/DuckDuckGo/Tab/Model/ContentScopeFeatureFlagging.swift +++ b/DuckDuckGo/Tab/Model/ContentScopeFeatureFlagging.swift @@ -32,6 +32,7 @@ extension ContentScopeFeatureToggles { passwordGeneration: autofillPrefs.askToSaveUsernamesAndPasswords, inlineIconCredentials: autofillPrefs.askToSaveUsernamesAndPasswords, thirdPartyCredentialsProvider: true, - unknownUsernameCategorization: privacyConfig.isSubfeatureEnabled(AutofillSubfeature.unknownUsernameCategorization)) + unknownUsernameCategorization: privacyConfig.isSubfeatureEnabled(AutofillSubfeature.unknownUsernameCategorization), + partialFormSaves: privacyConfig.isSubfeatureEnabled(AutofillSubfeature.partialFormSaves)) } } diff --git a/DuckDuckGo/Tab/Navigation/RedirectNavigationResponder.swift b/DuckDuckGo/Tab/Navigation/RedirectNavigationResponder.swift index 5e57ccab46..863a3c13ad 100644 --- a/DuckDuckGo/Tab/Navigation/RedirectNavigationResponder.swift +++ b/DuckDuckGo/Tab/Navigation/RedirectNavigationResponder.swift @@ -36,20 +36,4 @@ struct RedirectNavigationResponder: NavigationResponder { navigator.load(request) } } - -// private func redirectURL(for url: URL) -> URL? { -// guard url.isPart(ofDomain: "duckduckgo.com") else { return nil } -// -// if url.pathComponents == URL.privacyPro.pathComponents { -// let isFeatureAvailable = DefaultSubscriptionFeatureAvailability().isFeatureAvailable -// let subscriptionManager = Application.appDelegate.subscriptionManager -// let platform = subscriptionManager.currentEnvironment.purchasePlatform -// let shouldHidePrivacyProDueToNoProducts = platform == .appStore && subscriptionManager.canPurchase == false -// let isPurchasePageRedirectActive = isFeatureAvailable && !shouldHidePrivacyProDueToNoProducts -// let url = SubscriptionURL.baseURL.subscriptionURL(environment: subscriptionManager.currentEnvironment.serviceEnvironment) -// return isPurchasePageRedirectActive ? url : nil -// } -// -// return nil -// } } diff --git a/DuckDuckGo/Tab/UserScripts/UserScripts.swift b/DuckDuckGo/Tab/UserScripts/UserScripts.swift index c0e081eb2e..3d77e08fed 100644 --- a/DuckDuckGo/Tab/UserScripts/UserScripts.swift +++ b/DuckDuckGo/Tab/UserScripts/UserScripts.swift @@ -124,22 +124,20 @@ final class UserScripts: UserScriptsProvider { } userScripts.append(specialPages) } - - if DefaultSubscriptionFeatureAvailability().isFeatureAvailable { - let subscriptionManager = Application.appDelegate.subscriptionManager - let stripePurchaseFlow = DefaultStripePurchaseFlow(subscriptionManager: subscriptionManager) - let freemiumDBPPixelExperimentManager = FreemiumDBPPixelExperimentManager(subscriptionManager: subscriptionManager) - let delegate = SubscriptionPagesUseSubscriptionFeature(subscriptionManager: subscriptionManager, - stripePurchaseFlow: stripePurchaseFlow, - uiHandler: Application.appDelegate.subscriptionUIHandler, - freemiumDBPPixelExperimentManager: freemiumDBPPixelExperimentManager) - subscriptionPagesUserScript.registerSubfeature(delegate: delegate) - userScripts.append(subscriptionPagesUserScript) - - let identityTheftRestorationPagesFeature = IdentityTheftRestorationPagesFeature(subscriptionManager: subscriptionManager) - identityTheftRestorationPagesUserScript.registerSubfeature(delegate: identityTheftRestorationPagesFeature) - userScripts.append(identityTheftRestorationPagesUserScript) - } + + let subscriptionManager = Application.appDelegate.subscriptionManager + let stripePurchaseFlow = DefaultStripePurchaseFlow(subscriptionManager: subscriptionManager) + let freemiumDBPPixelExperimentManager = FreemiumDBPPixelExperimentManager(subscriptionManager: subscriptionManager) + let delegate = SubscriptionPagesUseSubscriptionFeature(subscriptionManager: subscriptionManager, + stripePurchaseFlow: stripePurchaseFlow, + uiHandler: Application.appDelegate.subscriptionUIHandler, + freemiumDBPPixelExperimentManager: freemiumDBPPixelExperimentManager) + subscriptionPagesUserScript.registerSubfeature(delegate: delegate) + userScripts.append(subscriptionPagesUserScript) + + let identityTheftRestorationPagesFeature = IdentityTheftRestorationPagesFeature(subscriptionManager: subscriptionManager) + identityTheftRestorationPagesUserScript.registerSubfeature(delegate: identityTheftRestorationPagesFeature) + userScripts.append(identityTheftRestorationPagesUserScript) } lazy var userScripts: [UserScript] = [ diff --git a/DuckDuckGo/Waitlist/VPNFeatureGatekeeper.swift b/DuckDuckGo/Waitlist/VPNFeatureGatekeeper.swift index f51519429a..0ee219244b 100644 --- a/DuckDuckGo/Waitlist/VPNFeatureGatekeeper.swift +++ b/DuckDuckGo/Waitlist/VPNFeatureGatekeeper.swift @@ -63,11 +63,7 @@ struct DefaultVPNFeatureGatekeeper: VPNFeatureGatekeeper { /// For subscription users this means they have entitlements. /// func canStartVPN() async -> Bool { - guard subscriptionFeatureAvailability.isFeatureAvailable else { - return false - } - let isNetworkProtectionEnabled = await subscriptionManager.isFeatureActive(.networkProtection) - return isNetworkProtectionEnabled + return await subscriptionManager.isFeatureActive(.networkProtection) } /// Whether the user can see the VPN entry points in the UI. @@ -76,24 +72,14 @@ struct DefaultVPNFeatureGatekeeper: VPNFeatureGatekeeper { /// For subscription users this means they are authenticated. /// func isVPNVisible() -> Bool { - guard subscriptionFeatureAvailability.isFeatureAvailable else { - return false - } return subscriptionManager.isUserAuthenticated } - /// We've had to add this method because accessing the singleton in app delegate is crashing the integration tests. - /// - var subscriptionFeatureAvailability: DefaultSubscriptionFeatureAvailability { - DefaultSubscriptionFeatureAvailability() - } - /// Returns whether the VPN should be uninstalled automatically. /// This is only true when the user is not an Easter Egg user, the waitlist test has ended, and the user is onboarded. func shouldUninstallAutomatically() -> Bool { - return subscriptionFeatureAvailability.isFeatureAvailable - && !subscriptionManager.isUserAuthenticated - && LoginItem.vpnMenu.status.isInstalled + !subscriptionManager.isUserAuthenticated && + LoginItem.vpnMenu.status.isInstalled } /// Whether the user is fully onboarded diff --git a/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift b/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift index 6a47bf6bd7..acc5d3468c 100644 --- a/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift +++ b/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift @@ -33,8 +33,7 @@ final class DuckDuckGoDBPBackgroundAgentApplication: NSApplication { private let subscriptionManager: SubscriptionManager override init() { - Logger.dbpBackgroundAgent.debug("🟢 Starting: \(NSRunningApplication.current.processIdentifier, privacy: .public)") - + Logger.dbpBackgroundAgent.log("🟢 Starting: \(NSRunningApplication.current.processIdentifier, privacy: .public)") let dryRun: Bool #if DEBUG dryRun = true @@ -112,7 +111,7 @@ final class DuckDuckGoDBPBackgroundAgentAppDelegate: NSObject, NSApplicationDele @MainActor func applicationDidFinishLaunching(_ aNotification: Notification) { - Logger.dbpBackgroundAgent.debug("DuckDuckGo DBP Agent launched") + Logger.dbpBackgroundAgent.log("DuckDuckGo DBP Agent launched") subscriptionManager.loadInitialData() manager?.agentFinishedLaunching() setupStatusBarMenu() diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index c60da923ba..4222192582 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), .package(path: "../SwiftUIExtensions"), .package(path: "../AppKitExtensions"), .package(path: "../XPCHelper"), diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionFeature.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionFeature.swift index 4e5732d38c..00b386824e 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionFeature.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionFeature.swift @@ -60,20 +60,20 @@ struct DataBrokerProtectionFeature: Subfeature { case .actionError: return onActionError } } else { - Logger.action.debug("Cant parse method: \(methodName, privacy: .public)") + Logger.action.log("Cant parse method: \(methodName, privacy: .public)") return nil } } func onActionCompleted(params: Any, original: WKScriptMessage) async throws -> Encodable? { - Logger.action.debug("Action completed") + Logger.action.log("Action completed") await parseActionCompleted(params: params) return nil } func parseActionCompleted(params: Any) async { - Logger.action.debug("Parse action completed") + Logger.action.log("Parse action completed") guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(CCFResult.self, from: data) else { @@ -91,7 +91,7 @@ struct DataBrokerProtectionFeature: Subfeature { } func parseSuccess(success: CCFSuccessResponse) async { - Logger.action.debug("Parse success: \(String(describing: success.actionType.rawValue), privacy: .public)") + Logger.action.log("Parse success: \(String(describing: success.actionType.rawValue), privacy: .public)") switch success.response { case .navigate(let navigate): @@ -114,7 +114,7 @@ struct DataBrokerProtectionFeature: Subfeature { func onActionError(params: Any, original: WKScriptMessage) async throws -> Encodable? { let error = DataBrokerProtectionError.parse(params: params) - Logger.action.debug("Action Error: \(String(describing: error.localizedDescription), privacy: .public)") + Logger.action.log("Action Error: \(String(describing: error.localizedDescription), privacy: .public)") await delegate?.onError(error: error) return nil @@ -129,7 +129,7 @@ struct DataBrokerProtectionFeature: Subfeature { assertionFailure("Cannot continue without broker instance") return } - Logger.action.debug("Pushing into WebView: \(method.rawValue) params \(String(describing: params))") + Logger.action.log("Pushing into WebView: \(method.rawValue) params \(String(describing: params))") broker.push(method: method.rawValue, params: params, for: self, into: webView) } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionUtils.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionUtils.swift index c67450cedb..d0d9299600 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionUtils.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/DataBrokerProtectionUtils.swift @@ -51,7 +51,7 @@ final class DataBrokerUserContentController: WKUserContentController { @MainActor public func cleanUpBeforeClosing() { - Logger.dataBrokerProtection.debug("Cleaning up DBP user scripts") + Logger.dataBrokerProtection.log("Cleaning up DBP user scripts") self.removeAllUserScripts() self.removeAllScriptMessageHandlers() @@ -61,7 +61,7 @@ final class DataBrokerUserContentController: WKUserContentController { } deinit { - Logger.dataBrokerProtection.debug("DataBrokerUserContentController Deinit") + Logger.dataBrokerProtection.log("DataBrokerUserContentController Deinit") } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/WebViewHandler.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/WebViewHandler.swift index d700a10837..72cf90dfdd 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/WebViewHandler.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/CCF/WebViewHandler.swift @@ -87,7 +87,7 @@ final class DataBrokerProtectionWebViewHandler: NSObject, WebViewHandler { func load(url: URL) async throws { webView?.load(url) - Logger.action.debug("Loading URL: \(String(describing: url.absoluteString))") + Logger.action.log("Loading URL: \(String(describing: url.absoluteString))") try await waitForWebViewLoad() } @@ -98,11 +98,11 @@ final class DataBrokerProtectionWebViewHandler: NSObject, WebViewHandler { } func finish() { - Logger.action.debug("WebViewHandler finished") + Logger.action.log("WebViewHandler finished") webView?.stopLoading() userContentController?.cleanUpBeforeClosing() WKWebsiteDataStore.default().removeData(ofTypes: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache], modifiedSince: Date(timeIntervalSince1970: 0)) { - Logger.action.debug("WKWebView data store deleted correctly") + Logger.action.log("WKWebView data store deleted correctly") } stopTimer() @@ -114,7 +114,7 @@ final class DataBrokerProtectionWebViewHandler: NSObject, WebViewHandler { } deinit { - Logger.action.debug("WebViewHandler Deinit") + Logger.action.log("WebViewHandler Deinit") } func waitForWebViewLoad() async throws { @@ -124,7 +124,7 @@ final class DataBrokerProtectionWebViewHandler: NSObject, WebViewHandler { } func execute(action: Action, data: CCFRequestData) { - Logger.action.debug("Executing action: \(String(describing: action.actionType.rawValue), privacy: .public)") + Logger.action.log("Executing action: \(String(describing: action.actionType.rawValue), privacy: .public)") userContentController?.dataBrokerUserScripts?.dataBrokerFeature.pushAction( method: .onActionReceived, @@ -225,7 +225,7 @@ extension DataBrokerProtectionWebViewHandler: WKNavigationDelegate { } func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - Logger.action.debug("WebViewHandler didFinish") + Logger.action.log("WebViewHandler didFinish") self.activeContinuation?.resume() self.activeContinuation = nil @@ -250,7 +250,7 @@ extension DataBrokerProtectionWebViewHandler: WKNavigationDelegate { } if statusCode >= 400 { - Logger.action.debug("WebViewHandler failed with status code: \(String(describing: statusCode), privacy: .public)") + Logger.action.log("WebViewHandler failed with status code: \(String(describing: statusCode), privacy: .public)") self.activeContinuation?.resume(throwing: DataBrokerProtectionError.httpError(code: statusCode)) self.activeContinuation = nil } @@ -289,6 +289,6 @@ private class WebView: WKWebView { deinit { configuration.userContentController.removeAllUserScripts() - Logger.action.debug("DBP WebView Deinit") + Logger.action.log("DBP WebView Deinit") } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Database/DataBrokerProtectionDataManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Database/DataBrokerProtectionDataManager.swift index f6ad3673cb..44e92346ac 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Database/DataBrokerProtectionDataManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Database/DataBrokerProtectionDataManager.swift @@ -94,7 +94,7 @@ public class DataBrokerProtectionDataManager: DataBrokerProtectionDataManaging { public func fetchProfile() throws -> DataBrokerProtectionProfile? { if cache.profile != nil { - Logger.dataBrokerProtection.debug("Returning cached profile") + Logger.dataBrokerProtection.log("Returning cached profile") return cache.profile } @@ -114,7 +114,7 @@ public class DataBrokerProtectionDataManager: DataBrokerProtectionDataManaging { cache.profile = profile return profile } else { - Logger.dataBrokerProtection.debug("No profile found") + Logger.dataBrokerProtection.log("No profile found") return nil } } @@ -123,13 +123,13 @@ public class DataBrokerProtectionDataManager: DataBrokerProtectionDataManaging { if let profile = try database.fetchProfile() { cache.profile = profile } else { - Logger.dataBrokerProtection.debug("No profile found") + Logger.dataBrokerProtection.log("No profile found") } } public func fetchBrokerProfileQueryData(ignoresCache: Bool = false) throws -> [BrokerProfileQueryData] { if !ignoresCache, !cache.brokerProfileQueryData.isEmpty { - Logger.dataBrokerProtection.debug("Returning cached brokerProfileQueryData") + Logger.dataBrokerProtection.log("Returning cached brokerProfileQueryData") return cache.brokerProfileQueryData } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift index 117ae11d94..f5b89554c6 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift @@ -165,7 +165,8 @@ final class DataBrokerRunCustomJSONViewModel: ObservableObject { passwordGeneration: false, inlineIconCredentials: false, thirdPartyCredentialsProvider: false, - unknownUsernameCategorization: false) + unknownUsernameCategorization: false, + partialFormSaves: false) let sessionKey = UUID().uuidString let messageSecret = UUID().uuidString @@ -339,7 +340,7 @@ final class DataBrokerRunCustomJSONViewModel: ObservableObject { let fileURL = URL(fileURLWithPath: "\(path)/\(fileName)") try csv.write(to: fileURL, atomically: true, encoding: .utf8) } else { - Logger.dataBrokerProtection.debug("Error getting path") + Logger.dataBrokerProtection.error("Error getting path") } } catch { Logger.dataBrokerProtection.error("Error writing to file: \(error)") diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJobRunner.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJobRunner.swift index 0c8cb4987d..78d1c9fb2c 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJobRunner.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJobRunner.swift @@ -125,6 +125,6 @@ final class DataBrokerJobRunner: WebJobRunner { } deinit { - Logger.dataBrokerProtection.debug("WebOperationRunner Deinit") + Logger.dataBrokerProtection.log("WebOperationRunner Deinit") } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperation.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperation.swift index a04ab7d0b4..b7f3e6fe7f 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperation.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperation.swift @@ -64,7 +64,7 @@ class DataBrokerOperation: Operation, @unchecked Sendable { private var _isFinished = false deinit { - Logger.dataBrokerProtection.debug("Deinit operation: \(String(describing: self.id.uuidString), privacy: .public)") + Logger.dataBrokerProtection.log("Deinit operation: \(String(describing: self.id.uuidString), privacy: .public)") } init(dataBrokerID: Int64, @@ -156,11 +156,11 @@ class DataBrokerOperation: Operation, @unchecked Sendable { operationType: operationType, priorityDate: priorityDate) - Logger.dataBrokerProtection.debug("filteredAndSortedOperationsData count: \(filteredAndSortedOperationsData.count, privacy: .public) for brokerID \(self.dataBrokerID, privacy: .public)") + Logger.dataBrokerProtection.log("filteredAndSortedOperationsData count: \(filteredAndSortedOperationsData.count, privacy: .public) for brokerID \(self.dataBrokerID, privacy: .public)") for operationData in filteredAndSortedOperationsData { if isCancelled { - Logger.dataBrokerProtection.debug("Cancelled operation, returning...") + Logger.dataBrokerProtection.log("Cancelled operation, returning...") return } @@ -172,7 +172,7 @@ class DataBrokerOperation: Operation, @unchecked Sendable { continue } do { - Logger.dataBrokerProtection.debug("Running operation: \(String(describing: operationData), privacy: .public)") + Logger.dataBrokerProtection.log("Running operation: \(String(describing: operationData), privacy: .public)") try await DataBrokerProfileQueryOperationManager().runOperation(operationData: operationData, brokerProfileQueryData: brokerProfileData, @@ -189,7 +189,7 @@ class DataBrokerOperation: Operation, @unchecked Sendable { }) let sleepInterval = operationDependencies.config.intervalBetweenSameBrokerOperations - Logger.dataBrokerProtection.debug("Waiting...: \(sleepInterval, privacy: .public)") + Logger.dataBrokerProtection.log("Waiting...: \(sleepInterval, privacy: .public)") try await Task.sleep(nanoseconds: UInt64(sleepInterval) * 1_000_000_000) } catch { Logger.dataBrokerProtection.error("Error: \(error.localizedDescription, privacy: .public)") @@ -211,7 +211,7 @@ class DataBrokerOperation: Operation, @unchecked Sendable { didChangeValue(forKey: #keyPath(isExecuting)) didChangeValue(forKey: #keyPath(isFinished)) - Logger.dataBrokerProtection.debug("Finished operation: \(self.id.uuidString, privacy: .public)") + Logger.dataBrokerProtection.log("Finished operation: \(self.id.uuidString, privacy: .public)") } } // swiftlint:enable explicit_non_final_class diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift index 6bb37ceb99..f8d0161d74 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift @@ -111,7 +111,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { isManual: Bool = false, userNotificationService: DataBrokerProtectionUserNotificationService, shouldRunNextStep: @escaping () -> Bool) async throws { - Logger.dataBrokerProtection.debug("Running scan operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") + Logger.dataBrokerProtection.log("Running scan operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") guard let brokerId = brokerProfileQueryData.dataBroker.id, let profileQueryId = brokerProfileQueryData.profileQuery.id else { // Maybe send pixel? @@ -120,7 +120,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { defer { try? database.updateLastRunDate(Date(), brokerId: brokerId, profileQueryId: profileQueryId) - Logger.dataBrokerProtection.debug("Finished scan operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") + Logger.dataBrokerProtection.log("Finished scan operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") notificationCenter.post(name: DataBrokerProtectionNotifications.didFinishScan, object: brokerProfileQueryData.dataBroker.name) } @@ -135,7 +135,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { try database.add(event) let extractedProfiles = try await runner.scan(brokerProfileQueryData, stageCalculator: stageCalculator, pixelHandler: pixelHandler, showWebView: showWebView, shouldRunNextStep: shouldRunNextStep) - Logger.dataBrokerProtection.debug("Extracted profiles: \(extractedProfiles)") + Logger.dataBrokerProtection.log("Extracted profiles: \(extractedProfiles)") if !extractedProfiles.isEmpty { stageCalculator.fireScanSuccess(matchesFound: extractedProfiles.count) @@ -158,7 +158,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { try database.updateRemovedDate(nil, on: id) } - Logger.dataBrokerProtection.debug("Extracted profile already exists in database: \(id.description)") + Logger.dataBrokerProtection.log("Extracted profile already exists in database: \(id.description)") } else { // If it's a new found profile, we'd like to opt-out ASAP // If this broker has a parent opt out, we set the preferred date to nil, as we will only perform the operation within the parent. @@ -185,7 +185,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { try database.saveOptOutJob(optOut: optOutJobData, extractedProfile: extractedProfile) - Logger.dataBrokerProtection.debug("Creating new opt-out operation data for: \(String(describing: extractedProfile.name))") + Logger.dataBrokerProtection.log("Creating new opt-out operation data for: \(String(describing: extractedProfile.name))") } } } else { @@ -218,7 +218,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { database: database ) - Logger.dataBrokerProtection.debug("Profile removed from optOutsData: \(String(describing: removedProfile))") + Logger.dataBrokerProtection.log("Profile removed from optOutsData: \(String(describing: removedProfile))") if let attempt = try database.fetchAttemptInformation(for: extractedProfileId), let attemptUUID = UUID(uuidString: attempt.attemptId) { let now = Date() @@ -291,12 +291,12 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { } guard extractedProfile.removedDate == nil else { - Logger.dataBrokerProtection.debug("Profile already extracted, skipping...") + Logger.dataBrokerProtection.log("Profile already extracted, skipping...") return } guard let optOutStep = brokerProfileQueryData.dataBroker.optOutStep(), optOutStep.optOutType != .parentSiteOptOut else { - Logger.dataBrokerProtection.debug("Broker opts out in parent, skipping...") + Logger.dataBrokerProtection.log("Broker opts out in parent, skipping...") return } @@ -305,10 +305,10 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { dataBrokerVersion: brokerProfileQueryData.dataBroker.version, handler: pixelHandler) stageDurationCalculator.fireOptOutStart() - Logger.dataBrokerProtection.debug("Running opt-out operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") + Logger.dataBrokerProtection.log("Running opt-out operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") defer { - Logger.dataBrokerProtection.debug("Finished opt-out operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") + Logger.dataBrokerProtection.log("Finished opt-out operation: \(brokerProfileQueryData.dataBroker.name, privacy: .public)") try? database.updateLastRunDate(Date(), brokerId: brokerId, profileQueryId: profileQueryId, extractedProfileId: extractedProfileId) do { @@ -443,7 +443,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { database: database ) } catch { - Logger.dataBrokerProtection.debug("Can't update operation date after error") + Logger.dataBrokerProtection.log("Can't update operation date after error") } Logger.dataBrokerProtection.error("Error on operation : \(error.localizedDescription, privacy: .public)") diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift index b0cb3912dc..8863e26d18 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift @@ -144,7 +144,7 @@ public struct DefaultDataBrokerProtectionBrokerUpdater: DataBrokerProtectionBrok return DefaultDataBrokerProtectionBrokerUpdater(vault: vault) } - Logger.dataBrokerProtection.debug("Error when trying to create vault for data broker protection updater debug menu item") + Logger.dataBrokerProtection.log("Error when trying to create vault for data broker protection updater debug menu item") return nil } @@ -163,7 +163,7 @@ public struct DefaultDataBrokerProtectionBrokerUpdater: DataBrokerProtectionBrok do { try update(broker) } catch { - Logger.dataBrokerProtection.debug("Error updating broker: \(broker.name, privacy: .public), with version: \(broker.version, privacy: .public)") + Logger.dataBrokerProtection.log("Error updating broker: \(broker.name, privacy: .public), with version: \(broker.version, privacy: .public)") pixelHandler.fire(.generalError(error: error, functionOccurredIn: "DataBrokerProtectionBrokerUpdater.updateBrokers")) } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/OperationPreferredDateUpdater.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/OperationPreferredDateUpdater.swift index eb519e78ab..5769e8626b 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/OperationPreferredDateUpdater.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/OperationPreferredDateUpdater.swift @@ -174,6 +174,6 @@ struct OperationPreferredDateUpdaterUseCase: OperationPreferredDateUpdater { throw error } - Logger.dataBrokerProtection.debug("Updating preferredRunDate on operation with brokerId \(brokerId.description, privacy: .public) and profileQueryId \(profileQueryId.description, privacy: .public)") + Logger.dataBrokerProtection.log("Updating preferredRunDate on operation with brokerId \(brokerId.description, privacy: .public) and profileQueryId \(profileQueryId.description, privacy: .public)") } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionEngagementPixels.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionEngagementPixels.swift index 72daf99102..c16e9e8411 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionEngagementPixels.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionEngagementPixels.swift @@ -107,7 +107,7 @@ final class DataBrokerProtectionEngagementPixels { func fireEngagementPixel(currentDate: Date = Date()) { guard (try? database.fetchProfile()) != nil else { - Logger.dataBrokerProtection.debug("No profile. We do not fire any pixel because we do not consider it an engaged user.") + Logger.dataBrokerProtection.log("No profile. We do not fire any pixel because we do not consider it an engaged user.") return } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift index 90738c320c..4097224d5c 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift @@ -59,7 +59,8 @@ public class DataBrokerProtectionAgentManagerProvider { passwordGeneration: false, inlineIconCredentials: false, thirdPartyCredentialsProvider: false, - unknownUsernameCategorization: false) + unknownUsernameCategorization: false, + partialFormSaves: false) let contentScopeProperties = ContentScopeProperties(gpcEnabled: false, sessionKey: UUID().uuidString, messageSecret: UUID().uuidString, @@ -269,15 +270,15 @@ extension DataBrokerProtectionAgentManager: DataBrokerProtectionAgentAppEvents { switch oneTimeError { case DataBrokerProtectionQueueError.interrupted: self.pixelHandler.fire(.ipcServerImmediateScansInterrupted) - Logger.dataBrokerProtection.debug("Interrupted during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted(), error: \(oneTimeError.localizedDescription, privacy: .public)") + Logger.dataBrokerProtection.error("Interrupted during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted(), error: \(oneTimeError.localizedDescription, privacy: .public)") default: self.pixelHandler.fire(.ipcServerImmediateScansFinishedWithError(error: oneTimeError)) - Logger.dataBrokerProtection.debug("Error during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, error: \(oneTimeError.localizedDescription, privacy: .public)") + Logger.dataBrokerProtection.error("Error during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, error: \(oneTimeError.localizedDescription, privacy: .public)") } } if let operationErrors = errors.operationErrors, operationErrors.count != 0 { - Logger.dataBrokerProtection.debug("Operation error(s) during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, count: \(operationErrors.count, privacy: .public)") + Logger.dataBrokerProtection.log("Operation error(s) during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, count: \(operationErrors.count, privacy: .public)") } } @@ -311,18 +312,18 @@ extension DataBrokerProtectionAgentManager: DataBrokerProtectionAgentAppEvents { switch oneTimeError { case DataBrokerProtectionQueueError.interrupted: self.pixelHandler.fire(.ipcServerAppLaunchedScheduledScansInterrupted) - Logger.dataBrokerProtection.debug("Interrupted during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted(), error: \(oneTimeError.localizedDescription, privacy: .public)") + Logger.dataBrokerProtection.log("Interrupted during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted(), error: \(oneTimeError.localizedDescription, privacy: .public)") case DataBrokerProtectionQueueError.cannotInterrupt: self.pixelHandler.fire(.ipcServerAppLaunchedScheduledScansBlocked) - Logger.dataBrokerProtection.debug("Cannot interrupt during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted()") + Logger.dataBrokerProtection.log("Cannot interrupt during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted()") default: self.pixelHandler.fire(.ipcServerAppLaunchedScheduledScansFinishedWithError(error: oneTimeError)) - Logger.dataBrokerProtection.debug("Error during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted, error: \(oneTimeError.localizedDescription, privacy: .public)") + Logger.dataBrokerProtection.log("Error during DataBrokerProtectionAgentManager.appLaunched in queueManager.startScheduledOperationsIfPermitted, error: \(oneTimeError.localizedDescription, privacy: .public)") } } if let operationErrors = errors.operationErrors, operationErrors.count != 0 { - Logger.dataBrokerProtection.debug("Operation error(s) during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, count: \(operationErrors.count, privacy: .public)") + Logger.dataBrokerProtection.log("Operation error(s) during DataBrokerProtectionAgentManager.profileSaved in queueManager.startImmediateOperationsIfPermitted, count: \(operationErrors.count, privacy: .public)") } } @@ -339,7 +340,7 @@ extension DataBrokerProtectionAgentManager: DataBrokerProtectionAgentAppEvents { self.pixelHandler.fire(.initialScanTotalDuration(duration: durationSinceStart.rounded(.towardZero), profileQueries: profileQueries)) } catch { - Logger.dataBrokerProtection.debug("Initial Scans Error when trying to fetch the profile to get the profile queries") + Logger.dataBrokerProtection.log("Initial Scans Error when trying to fetch the profile to get the profile queries") } } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionBackgroundActivityScheduler.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionBackgroundActivityScheduler.swift index d98adfdeda..f3879a6d77 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionBackgroundActivityScheduler.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionBackgroundActivityScheduler.swift @@ -52,9 +52,9 @@ public final class DefaultDataBrokerProtectionBackgroundActivityScheduler: DataB activity.schedule { completion in self.lastTriggerTimestamp = Date() - Logger.dataBrokerProtection.debug("Scheduler running...") + Logger.dataBrokerProtection.log("Scheduler running...") self.delegate?.dataBrokerProtectionBackgroundActivitySchedulerDidTrigger(self) { - Logger.dataBrokerProtection.debug("Scheduler finished...") + Logger.dataBrokerProtection.log("Scheduler finished...") completion(.finished) } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionKeyStoreProvider.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionKeyStoreProvider.swift index e903375725..7ab4832117 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionKeyStoreProvider.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionKeyStoreProvider.swift @@ -104,7 +104,7 @@ private extension DataBrokerProtectionKeyStoreProvider { let legacyAttributes = whenUnlockedQueryAttributes(named: name, serviceName: serviceName) let accessibilityValueString = legacyAttributes[kSecAttrAccessible as String] as? String ?? "[value unavailable]" - Logger.dataBrokerProtection.debug("Attempting read and migrate of DBP Keychain data with kSecAttrAccessible value of \(accessibilityValueString)") + Logger.dataBrokerProtection.log("Attempting read and migrate of DBP Keychain data with kSecAttrAccessible value of \(accessibilityValueString)") if let data = try read(serviceName: serviceName, queryAttributes: legacyAttributes) { // We found Keychain data, so update it's `kSecAttrAccessible` value to `kSecAttrAccessibleAfterFirstUnlock` @@ -164,7 +164,7 @@ private extension DataBrokerProtectionKeyStoreProvider { } let accessibilityValueString = attributeUpdate[kSecAttrAccessible as String] as? String ?? "[value unavailable]" - Logger.dataBrokerProtection.debug("Updated DBP Keychain data kSecAttrAccessible value to \(accessibilityValueString)") + Logger.dataBrokerProtection.log("Updated DBP Keychain data kSecAttrAccessible value to \(accessibilityValueString)") } func afterFirstUnlockQueryAttributes(named name: String, serviceName: String) -> [String: Any] { diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift index 5992962044..ce399fe44b 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift @@ -93,7 +93,7 @@ struct DBPUICommunicationLayer: Subfeature { func handler(forMethodNamed methodName: String) -> Handler? { guard let actionResult = DBPUIReceivedMethodName(rawValue: methodName) else { - Logger.dataBrokerProtection.debug("Cant parse method: \(methodName, privacy: .public)") + Logger.dataBrokerProtection.log("Cant parse method: \(methodName, privacy: .public)") return nil } @@ -123,7 +123,7 @@ struct DBPUICommunicationLayer: Subfeature { func handshake(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIHandshake.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse handshake message") + Logger.dataBrokerProtection.log("Failed to parse handshake message") throw DBPUIError.malformedRequest } @@ -131,16 +131,16 @@ struct DBPUICommunicationLayer: Subfeature { let userData = delegate?.getHandshakeUserData() ?? DBPUIHandshakeUserData(isAuthenticatedUser: true) if result.version != Constants.version { - Logger.dataBrokerProtection.debug("Incorrect protocol version presented by UI") + Logger.dataBrokerProtection.log("Incorrect protocol version presented by UI") return DBPUIHandshakeResponse(version: Constants.version, success: false, userdata: userData) } - Logger.dataBrokerProtection.debug("Successful handshake made by UI") + Logger.dataBrokerProtection.log("Successful handshake made by UI") return DBPUIHandshakeResponse(version: Constants.version, success: true, userdata: userData) } func saveProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { - Logger.dataBrokerProtection.debug("Web UI requested to save the profile") + Logger.dataBrokerProtection.log("Web UI requested to save the profile") do { try await delegate?.saveProfile() @@ -172,7 +172,7 @@ struct DBPUICommunicationLayer: Subfeature { func addNameToCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIUserProfileName.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse addNameToCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse addNameToCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -186,7 +186,7 @@ struct DBPUICommunicationLayer: Subfeature { func setNameAtIndexInCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUINameAtIndex.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse removeNameFromCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse removeNameFromCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -200,7 +200,7 @@ struct DBPUICommunicationLayer: Subfeature { func removeNameAtIndexFromCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIIndex.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse removeNameAtIndexFromCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse removeNameAtIndexFromCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -214,7 +214,7 @@ struct DBPUICommunicationLayer: Subfeature { func setBirthYearForCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIBirthYear.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse setBirthYearForCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse setBirthYearForCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -228,7 +228,7 @@ struct DBPUICommunicationLayer: Subfeature { func addAddressToCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIUserProfileAddress.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse addAddressToCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse addAddressToCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -242,7 +242,7 @@ struct DBPUICommunicationLayer: Subfeature { func setAddressAtIndexInCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIAddressAtIndex.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse removeAddressFromCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse removeAddressFromCurrentUserProfile message") throw DBPUIError.malformedRequest } @@ -256,7 +256,7 @@ struct DBPUICommunicationLayer: Subfeature { func removeAddressAtIndexFromCurrentUserProfile(params: Any, original: WKScriptMessage) async throws -> Encodable? { guard let data = try? JSONSerialization.data(withJSONObject: params), let result = try? JSONDecoder().decode(DBPUIIndex.self, from: data) else { - Logger.dataBrokerProtection.debug("Failed to parse removeNameAtIndexFromCurrentUserProfile message") + Logger.dataBrokerProtection.log("Failed to parse removeNameAtIndexFromCurrentUserProfile message") throw DBPUIError.malformedRequest } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift index 36efa17943..51f61e7e28 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift @@ -240,7 +240,7 @@ struct MapperToUI { encoder.outputFormatting = .prettyPrinted let jsonData = try encoder.encode(metadataUI) if let jsonString = String(data: jsonData, encoding: .utf8) { - Logger.dataBrokerProtection.debug("Metadata: \(jsonString, privacy: .public)") + Logger.dataBrokerProtection.log("Metadata: \(jsonString, privacy: .public)") } } catch { Logger.dataBrokerProtection.error("Error encoding struct to JSON: \(error.localizedDescription, privacy: .public)") diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UserNotifications/DataBrokerProtectionUserNotificationService.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UserNotifications/DataBrokerProtectionUserNotificationService.swift index 6e39a50336..a25247c0e6 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UserNotifications/DataBrokerProtectionUserNotificationService.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UserNotifications/DataBrokerProtectionUserNotificationService.swift @@ -97,7 +97,7 @@ public class DefaultDataBrokerProtectionUserNotificationService: NSObject, DataB if let days = days { let calendar = Calendar.current guard let date = calendar.date(byAdding: .day, value: days, to: Date()) else { - Logger.dataBrokerProtection.debug("Notification scheduled for an invalid date") + Logger.dataBrokerProtection.log("Notification scheduled for an invalid date") return } let components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: date) @@ -110,9 +110,9 @@ public class DefaultDataBrokerProtectionUserNotificationService: NSObject, DataB userNotificationCenter.add(request) { error in if error == nil { if days != nil { - Logger.dataBrokerProtection.debug("Notification scheduled") + Logger.dataBrokerProtection.log("Notification scheduled") } else { - Logger.dataBrokerProtection.debug("Notification sent") + Logger.dataBrokerProtection.log("Notification sent") } } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift index 35c37d960e..bd61fd0592 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift @@ -65,13 +65,13 @@ struct DefaultDataBrokerProtectionAgentStopper: DataBrokerProtectionAgentStopper let didActivateFreemium = freemiumDBPUserStateManager.didActivate if !hasProfile || (!isAuthenticated && !didActivateFreemium) { - Logger.dataBrokerProtection.debug("Prerequisites are invalid") + Logger.dataBrokerProtection.log("Prerequisites are invalid") stopAgent() return } if satisfiesFreemiumPrerequisites() { - Logger.dataBrokerProtection.debug("User is Freemium") + Logger.dataBrokerProtection.log("User is Freemium") return } @@ -107,14 +107,14 @@ struct DefaultDataBrokerProtectionAgentStopper: DataBrokerProtectionAgentStopper private func stopAgentBasedOnEntitlementCheckResult(_ result: DataBrokerProtectionEntitlementMonitorResult) { switch result { case .enabled: - Logger.dataBrokerProtection.debug("Valid entitlement") + Logger.dataBrokerProtection.log("Valid entitlement") pixelHandler.fire(.entitlementCheckValid) case .disabled: - Logger.dataBrokerProtection.debug("Invalid entitlement") + Logger.dataBrokerProtection.log("Invalid entitlement") pixelHandler.fire(.entitlementCheckInvalid) stopAgent() case .error: - Logger.dataBrokerProtection.debug("Error when checking entitlement") + Logger.dataBrokerProtection.log("Error when checking entitlement") /// We don't want to disable the agent in case of an error while checking for entitlements. /// Since this is a destructive action, the only situation that should cause the data to be deleted and the agent to be removed is .success(false) pixelHandler.fire(.entitlementCheckError) @@ -128,7 +128,7 @@ protocol DataProtectionStopAction { struct DefaultDataProtectionStopAction: DataProtectionStopAction { func stopAgent() { - Logger.dataBrokerProtection.debug("Stopping DataBrokerProtection Agent") + Logger.dataBrokerProtection.log("Stopping DataBrokerProtection Agent") exit(EXIT_SUCCESS) } } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionSleepObserver.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionSleepObserver.swift index 69088e8cb9..1492c8a722 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionSleepObserver.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionSleepObserver.swift @@ -41,7 +41,7 @@ final class DataBrokerProtectionSleepObserver: SleepObserver { } deinit { - Logger.dataBrokerProtection.debug("SleepObserver: Deinit \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") + Logger.dataBrokerProtection.log("SleepObserver: Deinit \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") NotificationCenter.default.removeObserver(self) } @@ -50,18 +50,18 @@ final class DataBrokerProtectionSleepObserver: SleepObserver { return 0 } - Logger.dataBrokerProtection.debug("SleepObserver: Total Sleep time more than zero: \(String(totalSleepTime), privacy: .public)") + Logger.dataBrokerProtection.log("SleepObserver: Total Sleep time more than zero: \(String(totalSleepTime), privacy: .public)") return totalSleepTime } @objc func willSleepNotification(_ notification: Notification) { - Logger.dataBrokerProtection.debug("SleepObserver: Computer will sleep on \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") + Logger.dataBrokerProtection.log("SleepObserver: Computer will sleep on \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") startSleepTime = Date() } @objc func didWakeNotification(_ notification: Notification) { - Logger.dataBrokerProtection.debug("SleepObserver: Computer waking up \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") + Logger.dataBrokerProtection.log("SleepObserver: Computer waking up \(self.brokerProfileQueryData.dataBroker.name, privacy: .public) \(self.brokerProfileQueryData.profileQuery.firstName, privacy: .public) \(self.brokerProfileQueryData.profileQuery.city, privacy: .public)") guard let startSleepTime = self.startSleepTime else { return } diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift index ffdda6271f..f4f03905b8 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift @@ -273,7 +273,8 @@ extension ContentScopeFeatureToggles { passwordGeneration: false, inlineIconCredentials: false, thirdPartyCredentialsProvider: false, - unknownUsernameCategorization: false + unknownUsernameCategorization: false, + partialFormSaves: false ) } } diff --git a/LocalPackages/FeatureFlags/Package.swift b/LocalPackages/FeatureFlags/Package.swift index 5cdd9db7b0..5b863978ae 100644 --- a/LocalPackages/FeatureFlags/Package.swift +++ b/LocalPackages/FeatureFlags/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["FeatureFlags"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/LocalPackages/FeatureFlags/Sources/FeatureFlags/FeatureFlag.swift b/LocalPackages/FeatureFlags/Sources/FeatureFlags/FeatureFlag.swift index 23f683678f..ca29d420f8 100644 --- a/LocalPackages/FeatureFlags/Sources/FeatureFlags/FeatureFlag.swift +++ b/LocalPackages/FeatureFlags/Sources/FeatureFlags/FeatureFlag.swift @@ -47,17 +47,13 @@ public enum FeatureFlag: String, CaseIterable { /// https://app.asana.com/0/72649045549333/1208241266421040/f case htmlNewTabPage - case isPrivacyProLaunchedROW - case isPrivacyProLaunchedROWOverride - case autofillPartialFormSaves } extension FeatureFlag: FeatureFlagDescribing { public var supportsLocalOverriding: Bool { switch self { - case .htmlNewTabPage, - .isPrivacyProLaunchedROWOverride: + case .htmlNewTabPage: return true case .maliciousSiteProtection: return true @@ -71,8 +67,7 @@ extension FeatureFlag: FeatureFlagDescribing { .unknownUsernameCategorization, .credentialsImportPromotionForExistingUsers, .networkProtectionUserTips, - .networkProtectionEnforceRoutes, - .isPrivacyProLaunchedROW: + .networkProtectionEnforceRoutes: return false } } @@ -101,10 +96,6 @@ extension FeatureFlag: FeatureFlagDescribing { return .remoteDevelopment(.subfeature(NetworkProtectionSubfeature.enforceRoutes)) case .htmlNewTabPage: return .disabled - case .isPrivacyProLaunchedROW: - return .remoteReleasable(.subfeature(PrivacyProSubfeature.isLaunchedROW)) - case .isPrivacyProLaunchedROWOverride: - return .remoteReleasable(.subfeature(PrivacyProSubfeature.isLaunchedROWOverride)) case .autofillPartialFormSaves: return .remoteReleasable(.subfeature(AutofillSubfeature.partialFormSaves)) } diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 9cb58c15b0..03bfa9ca56 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -33,7 +33,7 @@ let package = Package( .library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"), .package(path: "../AppLauncher"), .package(path: "../UDSHelper"), diff --git a/LocalPackages/NewTabPage/Package.swift b/LocalPackages/NewTabPage/Package.swift index 1ea428644d..40f1360b7d 100644 --- a/LocalPackages/NewTabPage/Package.swift +++ b/LocalPackages/NewTabPage/Package.swift @@ -32,7 +32,7 @@ let package = Package( targets: ["NewTabPage"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), .package(path: "../WebKitExtensions"), .package(path: "../Utilities"), ], diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index c16d25e667..a6f3d3ff0d 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), .package(path: "../SwiftUIExtensions"), .package(path: "../FeatureFlags") ], diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift index 0d429f756a..c9c5953f70 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift @@ -45,7 +45,6 @@ public final class PreferencesSubscriptionModel: ObservableObject { var hasEmail: Bool { !(email?.isEmpty ?? true) } let featureFlagger: FeatureFlagger - var isROWLaunched: Bool = false private var subscriptionPlatform: PrivacyProSubscription.Platform? @@ -175,7 +174,6 @@ public final class PreferencesSubscriptionModel: ObservableObject { } else { self.subscriptionStorefrontRegion = currentStorefrontRegion() } - isROWLaunched = featureFlagger.isFeatureOn(.isPrivacyProLaunchedROW) || featureFlagger.isFeatureOn(.isPrivacyProLaunchedROWOverride) } private func updateUserAuthenticatedState() { diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift index 8bcc0f4ba0..a7d7cf88fa 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift @@ -298,13 +298,10 @@ public struct PreferencesSubscriptionView: View { private var helpSection: some View { PreferencePaneSection { TextMenuItemHeader(UserText.preferencesSubscriptionFooterTitle, bottomPadding: 0) - if !model.isROWLaunched { - TextMenuItemCaption(UserText.preferencesSubscriptionFooterCaption) - .padding(.bottom, 8) - } else { - TextMenuItemCaption(UserText.preferencesSubscriptionHelpFooterCaption) - .padding(.bottom, 8) - } + + TextMenuItemCaption(UserText.preferencesSubscriptionHelpFooterCaption) + .padding(.bottom, 8) + VStack(alignment: .leading, spacing: 16) { TextButton(UserText.viewFaqsButton, weight: .semibold) { model.openFAQ() } diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Resources/Localizable.xcstrings b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Resources/Localizable.xcstrings index f909d5486a..6d5811e393 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Resources/Localizable.xcstrings +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Resources/Localizable.xcstrings @@ -3713,7 +3713,7 @@ }, "subscription.preferences.subscription.footer.caption" : { "comment" : "Caption for the subscription preferences pane footer", - "extractionState" : "extracted_with_value", + "extractionState" : "stale", "localizations" : { "de" : { "stringUnit" : { diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift index d261650e18..4c3f1c4210 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift @@ -48,7 +48,6 @@ enum UserText { // MARK: Preferences footer static let preferencesSubscriptionFooterTitle = NSLocalizedString("subscription.preferences.subscription.footer.title", bundle: Bundle.module, value: "Need help with Privacy Pro?", comment: "Title for the subscription preferences pane footer") - static let preferencesSubscriptionFooterCaption = NSLocalizedString("subscription.preferences.subscription.footer.caption", bundle: Bundle.module, value: "Get answers to frequently asked questions or contact Privacy Pro support from our help pages.", comment: "Caption for the subscription preferences pane footer") static let preferencesSubscriptionHelpFooterCaption = NSLocalizedString("subscription.preferences.subscription.help.footer.caption", bundle: Bundle.module, value: "Get answers to frequently asked questions or contact Privacy Pro support from our help pages. Feature availability varies by country.", comment: "Caption for the subscription preferences pane footer") static let viewFaqsButton = NSLocalizedString("subscription.preferences.view.faqs.button", bundle: Bundle.module, value: "FAQs and Support", comment: "Button to open page for FAQs") static let preferencesSubscriptionFeedbackTitle = NSLocalizedString("subscription.preferences.feedback.title", bundle: Bundle.module, value: "Send Feedback", comment: "Title for the subscription feedback section") diff --git a/LocalPackages/WebKitExtensions/Package.swift b/LocalPackages/WebKitExtensions/Package.swift index df1842ee94..44b247d5ff 100644 --- a/LocalPackages/WebKitExtensions/Package.swift +++ b/LocalPackages/WebKitExtensions/Package.swift @@ -32,7 +32,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "224.3.0"), .package(path: "../AppKitExtensions") ], targets: [ diff --git a/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift b/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift index de88f54a26..2c3b3a4fe1 100644 --- a/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift +++ b/UnitTests/DBP/Tests/DataBrokerProtectionFeatureGatekeeperTests.swift @@ -154,7 +154,6 @@ private class MockFeatureAvailability: SubscriptionFeatureAvailability { var mockSubscriptionPurchaseAllowed: Bool = false var mockUsesUnifiedFeedbackForm: Bool = false - var isFeatureAvailable: Bool { mockFeatureAvailable } var isSubscriptionPurchaseAllowed: Bool { mockSubscriptionPurchaseAllowed } var usesUnifiedFeedbackForm: Bool { mockUsesUnifiedFeedbackForm } diff --git a/UnitTests/Menus/MoreOptionsMenuTests.swift b/UnitTests/Menus/MoreOptionsMenuTests.swift index 503b6d8360..188d45aa3e 100644 --- a/UnitTests/Menus/MoreOptionsMenuTests.swift +++ b/UnitTests/Menus/MoreOptionsMenuTests.swift @@ -81,8 +81,7 @@ final class MoreOptionsMenuTests: XCTestCase { moreOptionsMenu = MoreOptionsMenu(tabCollectionViewModel: tabCollectionViewModel, passwordManagerCoordinator: passwordManagerCoordinator, vpnFeatureGatekeeper: networkProtectionVisibilityMock, - subscriptionFeatureAvailability: SubscriptionFeatureAvailabilityMock(isFeatureAvailable: true, - isSubscriptionPurchaseAllowed: true, + subscriptionFeatureAvailability: SubscriptionFeatureAvailabilityMock(isSubscriptionPurchaseAllowed: true, usesUnifiedFeedbackForm: false), sharingMenu: NSMenu(), internalUserDecider: internalUserDecider, diff --git a/UnitTests/Subscription/Mocks/SubscriptionFeatureAvailabilityMock.swift b/UnitTests/Subscription/Mocks/SubscriptionFeatureAvailabilityMock.swift index f8ac00a609..4273492c3a 100644 --- a/UnitTests/Subscription/Mocks/SubscriptionFeatureAvailabilityMock.swift +++ b/UnitTests/Subscription/Mocks/SubscriptionFeatureAvailabilityMock.swift @@ -21,12 +21,10 @@ import Subscription import BrowserServicesKit public final class SubscriptionFeatureAvailabilityMock: SubscriptionFeatureAvailability { - public var isFeatureAvailable: Bool public var isSubscriptionPurchaseAllowed: Bool public var usesUnifiedFeedbackForm: Bool - public init(isFeatureAvailable: Bool, isSubscriptionPurchaseAllowed: Bool, usesUnifiedFeedbackForm: Bool) { - self.isFeatureAvailable = isFeatureAvailable + public init(isSubscriptionPurchaseAllowed: Bool, usesUnifiedFeedbackForm: Bool) { self.isSubscriptionPurchaseAllowed = isSubscriptionPurchaseAllowed self.usesUnifiedFeedbackForm = usesUnifiedFeedbackForm } diff --git a/UnitTests/Subscription/SubscriptionRedirectManagerTests.swift b/UnitTests/Subscription/SubscriptionRedirectManagerTests.swift index 13a5f591ac..481d21a8e1 100644 --- a/UnitTests/Subscription/SubscriptionRedirectManagerTests.swift +++ b/UnitTests/Subscription/SubscriptionRedirectManagerTests.swift @@ -34,8 +34,7 @@ final class SubscriptionRedirectManagerTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() - sut = PrivacyProSubscriptionRedirectManager(featureAvailabiltyProvider: true, - subscriptionEnvironment: Constants.environment, + sut = PrivacyProSubscriptionRedirectManager(subscriptionEnvironment: Constants.environment, baseURL: Constants.redirectURL, canPurchase: { [self] in canPurchase }) }