From 68a69a905b0816b551a320a299f6aa355a27e435 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:31:35 +0100 Subject: [PATCH] point to BSK branch and updates (#3636) Task/Issue URL: https://app.asana.com/0/1204186595873227/1208687542689225/f Tech Design URL: https://app.asana.com/0/1204186595873227/1208823859841917/f CC: **Description**: Updates BSK dependency --- Core/FeatureFlag.swift | 8 ++++---- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 8 ++++---- DuckDuckGo/AppDependencyProvider.swift | 3 ++- DuckDuckGoTests/AppUserDefaultsTests.swift | 2 +- DuckDuckGoTests/DuckPlayerMocks.swift | 12 ++++++++++++ DuckDuckGoTests/MockFeatureFlagger.swift | 12 ++++++++++++ DuckDuckGoTests/MockPrivacyConfiguration.swift | 12 ++++++++++++ .../NewTabPageShortcutsSettingsModelTests.swift | 12 ++++++++++++ .../PrivacyConfigurationManagerMock.swift | 12 ++++++++++++ 10 files changed, 72 insertions(+), 11 deletions(-) diff --git a/Core/FeatureFlag.swift b/Core/FeatureFlag.swift index da04bcfaf6..e500d934b4 100644 --- a/Core/FeatureFlag.swift +++ b/Core/FeatureFlag.swift @@ -66,7 +66,7 @@ extension FeatureFlag: FeatureFlagDescribing { public var source: FeatureFlagSource { switch self { case .debugMenu: - return .internalOnly + return .internalOnly() case .sync: return .remoteReleasable(.subfeature(SyncSubfeature.level0ShowSync)) case .autofillCredentialInjecting: @@ -106,9 +106,9 @@ extension FeatureFlag: FeatureFlagDescribing { case .syncPromotionPasswords: return .remoteReleasable(.subfeature(SyncPromotionSubfeature.passwords)) case .onboardingHighlights: - return .internalOnly + return .internalOnly() case .onboardingAddToDock: - return .internalOnly + return .internalOnly() case .autofillSurveys: return .remoteReleasable(.feature(.autofillSurveys)) case .autcompleteTabs: @@ -122,7 +122,7 @@ extension FeatureFlag: FeatureFlagDescribing { case .adAttributionReporting: return .remoteReleasable(.feature(.adAttributionReporting)) case .crashReportOptInStatusResetting: - return .internalOnly + return .internalOnly() } } } diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 3273c57da7..a5f1b08056 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -11251,7 +11251,7 @@ repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 212.1.1; + version = 213.0.0; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4b616ab2cf..926b926006 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { - "revision" : "db9c29a429896138fab29da987981a5f4a8d6712", - "version" : "212.1.1" + "revision" : "9563e1ea53ff0590e3bb78e566234907edb73678", + "version" : "213.0.0" } }, { @@ -122,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/privacy-dashboard", "state" : { - "revision" : "757bbbae1e2afbb421caee9bfca04ee5c56c3af8", - "version" : "7.2.0" + "revision" : "49db79829dcb166b3524afdbc1c680890452ce1c", + "version" : "7.2.1" } }, { diff --git a/DuckDuckGo/AppDependencyProvider.swift b/DuckDuckGo/AppDependencyProvider.swift index 245901da44..7e38af6475 100644 --- a/DuckDuckGo/AppDependencyProvider.swift +++ b/DuckDuckGo/AppDependencyProvider.swift @@ -94,7 +94,8 @@ final class AppDependencyProvider: DependencyProvider { private init() { featureFlagger = DefaultFeatureFlagger(internalUserDecider: internalUserDecider, - privacyConfigManager: ContentBlocking.shared.privacyConfigurationManager) + privacyConfigManager: ContentBlocking.shared.privacyConfigurationManager, + experimentManager: ExperimentCohortsManager(store: ExperimentsDataStore())) configurationManager = ConfigurationManager(store: configurationStore) diff --git a/DuckDuckGoTests/AppUserDefaultsTests.swift b/DuckDuckGoTests/AppUserDefaultsTests.swift index cc12ab3ecb..4aeb208c0b 100644 --- a/DuckDuckGoTests/AppUserDefaultsTests.swift +++ b/DuckDuckGoTests/AppUserDefaultsTests.swift @@ -226,7 +226,7 @@ class AppUserDefaultsTests: XCTestCase { mockManager.privacyConfig = mockConfiguration(subfeatureEnabled: enabled) let internalUserDecider = DefaultInternalUserDecider(store: internalUserDeciderStore) - return DefaultFeatureFlagger(internalUserDecider: internalUserDecider, privacyConfigManager: mockManager) + return DefaultFeatureFlagger(internalUserDecider: internalUserDecider, privacyConfigManager: mockManager, experimentManager: nil) } private func mockConfiguration(subfeatureEnabled: Bool) -> PrivacyConfiguration { diff --git a/DuckDuckGoTests/DuckPlayerMocks.swift b/DuckDuckGoTests/DuckPlayerMocks.swift index 7806c9d874..0c0844ebcd 100644 --- a/DuckDuckGoTests/DuckPlayerMocks.swift +++ b/DuckDuckGoTests/DuckPlayerMocks.swift @@ -254,6 +254,18 @@ final class MockDuckPlayerFeatureFlagger: FeatureFlagger { func isFeatureOn(for featureFlag: Flag, allowOverride: Bool) -> Bool { return !enabledFeatures.isEmpty } + + func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? { + return nil + } + + func getCohortIfEnabled(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing { + return nil + } + + func getAllActiveExperiments() -> Experiments { + return [:] + } } final class MockDuckPlayerStorage: DuckPlayerStorage { diff --git a/DuckDuckGoTests/MockFeatureFlagger.swift b/DuckDuckGoTests/MockFeatureFlagger.swift index 7a8f568486..7f6d1a8866 100644 --- a/DuckDuckGoTests/MockFeatureFlagger.swift +++ b/DuckDuckGoTests/MockFeatureFlagger.swift @@ -39,4 +39,16 @@ final class MockFeatureFlagger: FeatureFlagger { } return true } + + func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? { + return nil + } + + func getCohortIfEnabled(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing { + return nil + } + + func getAllActiveExperiments() -> Experiments { + return [:] + } } diff --git a/DuckDuckGoTests/MockPrivacyConfiguration.swift b/DuckDuckGoTests/MockPrivacyConfiguration.swift index 3066b1c3a6..07c69f3679 100644 --- a/DuckDuckGoTests/MockPrivacyConfiguration.swift +++ b/DuckDuckGoTests/MockPrivacyConfiguration.swift @@ -35,6 +35,18 @@ class MockPrivacyConfiguration: PrivacyConfiguration { return .disabled(.disabledInConfig) } + func stateFor(subfeatureID: SubfeatureID, parentFeatureID: ParentFeatureID, versionProvider: AppVersionProvider, randomizer: (Range) -> Double) -> PrivacyConfigurationFeatureState { + return .disabled(.disabledInConfig) + } + + func cohorts(for subfeature: any PrivacySubfeature) -> [PrivacyConfigurationData.Cohort]? { + return nil + } + + func cohorts(subfeatureID: SubfeatureID, parentFeatureID: ParentFeatureID) -> [PrivacyConfigurationData.Cohort]? { + return nil + } + var identifier: String = "MockPrivacyConfiguration" var version: String? = "123456789" var userUnprotectedDomains: [String] = [] diff --git a/DuckDuckGoTests/NewTabPageShortcutsSettingsModelTests.swift b/DuckDuckGoTests/NewTabPageShortcutsSettingsModelTests.swift index 9f3affb257..7561f7c206 100644 --- a/DuckDuckGoTests/NewTabPageShortcutsSettingsModelTests.swift +++ b/DuckDuckGoTests/NewTabPageShortcutsSettingsModelTests.swift @@ -73,4 +73,16 @@ private final class AlwaysTrueFeatureFlagger: FeatureFlagger { func isFeatureOn(for featureFlag: Flag, allowOverride: Bool) -> Bool { true } + + func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? { + return nil + } + + func getCohortIfEnabled(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing { + return nil + } + + func getAllActiveExperiments() -> Experiments { + return [:] + } } diff --git a/DuckDuckGoTests/PrivacyConfigurationManagerMock.swift b/DuckDuckGoTests/PrivacyConfigurationManagerMock.swift index d50a621f91..1f3128ec92 100644 --- a/DuckDuckGoTests/PrivacyConfigurationManagerMock.swift +++ b/DuckDuckGoTests/PrivacyConfigurationManagerMock.swift @@ -67,6 +67,18 @@ class PrivacyConfigurationMock: PrivacyConfiguration { return .disabled(.disabledInConfig) // this is not used in platform tests, so mocking this poorly for now } + func stateFor(subfeatureID: SubfeatureID, parentFeatureID: ParentFeatureID, versionProvider: AppVersionProvider, randomizer: (Range) -> Double) -> PrivacyConfigurationFeatureState { + return .disabled(.disabledInConfig) + } + + func cohorts(for subfeature: any PrivacySubfeature) -> [PrivacyConfigurationData.Cohort]? { + return nil + } + + func cohorts(subfeatureID: SubfeatureID, parentFeatureID: ParentFeatureID) -> [PrivacyConfigurationData.Cohort]? { + return nil + } + var protectedDomains = Set() func isProtected(domain: String?) -> Bool { return protectedDomains.contains(domain ?? "")