Skip to content

Commit

Permalink
point to BSK branch and updates (#3636)
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio authored Nov 29, 2024
1 parent 68a54cc commit 68a69a9
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -122,7 +122,7 @@ extension FeatureFlag: FeatureFlagDescribing {
case .adAttributionReporting:
return .remoteReleasable(.feature(.adAttributionReporting))
case .crashReportOptInStatusResetting:
return .internalOnly
return .internalOnly()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "db9c29a429896138fab29da987981a5f4a8d6712",
"version" : "212.1.1"
"revision" : "9563e1ea53ff0590e3bb78e566234907edb73678",
"version" : "213.0.0"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/AppDependencyProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGoTests/AppUserDefaultsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGoTests/DuckPlayerMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ final class MockDuckPlayerFeatureFlagger: FeatureFlagger {
func isFeatureOn<Flag: FeatureFlagDescribing>(for featureFlag: Flag, allowOverride: Bool) -> Bool {
return !enabledFeatures.isEmpty
}

func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? {
return nil
}

func getCohortIfEnabled<Flag>(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing {
return nil
}

func getAllActiveExperiments() -> Experiments {
return [:]
}
}

final class MockDuckPlayerStorage: DuckPlayerStorage {
Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGoTests/MockFeatureFlagger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ final class MockFeatureFlagger: FeatureFlagger {
}
return true
}

func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? {
return nil
}

func getCohortIfEnabled<Flag>(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing {
return nil
}

func getAllActiveExperiments() -> Experiments {
return [:]
}
}
12 changes: 12 additions & 0 deletions DuckDuckGoTests/MockPrivacyConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ class MockPrivacyConfiguration: PrivacyConfiguration {
return .disabled(.disabledInConfig)
}

func stateFor(subfeatureID: SubfeatureID, parentFeatureID: ParentFeatureID, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> 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] = []
Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGoTests/NewTabPageShortcutsSettingsModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,16 @@ private final class AlwaysTrueFeatureFlagger: FeatureFlagger {
func isFeatureOn<Flag: FeatureFlagDescribing>(for featureFlag: Flag, allowOverride: Bool) -> Bool {
true
}

func getCohortIfEnabled(_ subfeature: any PrivacySubfeature) -> CohortID? {
return nil
}

func getCohortIfEnabled<Flag>(for featureFlag: Flag) -> (any FlagCohort)? where Flag: FeatureFlagExperimentDescribing {
return nil
}

func getAllActiveExperiments() -> Experiments {
return [:]
}
}
12 changes: 12 additions & 0 deletions DuckDuckGoTests/PrivacyConfigurationManagerMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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>) -> 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<String>()
func isProtected(domain: String?) -> Bool {
return protectedDomains.contains(domain ?? "")
Expand Down

0 comments on commit 68a69a9

Please sign in to comment.