Skip to content

Commit

Permalink
point to BSK branch and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed Nov 28, 2024
1 parent fb6f424 commit 8dbb5a0
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15204,8 +15204,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 212.0.0;
branch = "sabrina/experiment-framework";
kind = branch;
};
};
9FF521422BAA8FF300B9819B /* 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" : "5a24a885425dcb5626353bf5a8ca6af79c44c1cb",
"version" : "212.0.0"
"branch" : "sabrina/experiment-framework",
"revision" : "1e426e2d17f5a6e2363d72a8f310c6db428fb513"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
keyValueStore: UserDefaults.appConfiguration,
actionHandler: FeatureFlagOverridesPublishingHandler<FeatureFlag>()
),
experimentManager: ExperimentCohortsManager(store: ExperimentsDataStore()),
for: FeatureFlag.self
)

Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGo/ContentBlocker/Mocks/MockPrivacyConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ final 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
}

func isFeature(_ feature: PrivacyFeature, enabledForDomain: String?) -> Bool { true }
func isProtected(domain: String?) -> Bool { true }
func isUserUnprotected(domain: String?) -> Bool { false }
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGoVPN/DuckDuckGoVPNAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ final class DuckDuckGoVPNAppDelegate: NSObject, NSApplicationDelegate {
private let privacyConfigurationManager = VPNPrivacyConfigurationManager(internalUserDecider: DefaultInternalUserDecider(store: UserDefaults.appConfiguration))
private lazy var featureFlagger = DefaultFeatureFlagger(
internalUserDecider: privacyConfigurationManager.internalUserDecider,
privacyConfigManager: privacyConfigurationManager)
privacyConfigManager: privacyConfigurationManager,
experimentManager: nil)

public init(accountManager: AccountManager,
accessTokenStorage: SubscriptionTokenKeychainStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,16 @@ class MockFeatureFlagger: FeatureFlagger {
func isFeatureOn<Flag: FeatureFlagDescribing>(for featureFlag: Flag, allowOverride: Bool) -> Bool {
return true
}

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

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

func getAllActiveExperiments() -> Experiments {
return [:]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ final class PrivacyConfigurationMock: PrivacyConfiguration {
func isSubfeatureEnabled(_ subfeature: any BrowserServicesKit.PrivacySubfeature, versionProvider: BrowserServicesKit.AppVersionProvider, randomizer: (Range<Double>) -> Double) -> Bool {
false
}

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
}
}

extension ContentScopeProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ extension FeatureFlag: FeatureFlagDescribing {
public var source: FeatureFlagSource {
switch self {
case .debugMenu:
return .internalOnly
return .internalOnly()
case .appendAtbToSerpQueries:
return .internalOnly
return .internalOnly()
case .sslCertificatesBypass:
return .remoteReleasable(.subfeature(SslCertificatesSubfeature.allowBypass))
case .unknownUsernameCategorization:
Expand Down
12 changes: 12 additions & 0 deletions UnitTests/Menus/MainMenuTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ private class DummyFeatureFlagger: FeatureFlagger {
func isFeatureOn<Flag: FeatureFlagDescribing>(for: Flag, allowOverride: Bool) -> Bool {
false
}

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

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

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

private class DummyAIChatConfig: AIChatMenuVisibilityConfigurable {
Expand Down
12 changes: 12 additions & 0 deletions UnitTests/TabExtensionsTests/ErrorPageTabExtensionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,16 @@ class MockFeatureFlagger: FeatureFlagger {
func isFeatureOn<Flag: FeatureFlagDescribing>(for featureFlag: Flag, allowOverride: Bool) -> Bool {
return isFeatureOn
}

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

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

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

0 comments on commit 8dbb5a0

Please sign in to comment.