Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 86cb666

Browse files
add support for feature flags overrides (#3892)
Task/Issue URL: https://app.asana.com/0/1204186595873227/1209266907041599/f Tech Design URL: https://app.asana.com/0/1204186595873227/1209266907041602/f CC: **Description**: Moves experiment flag to be part of FeatureFlag (conforming to FeatureFlagDescribing). Adds support for feature flags overrides
1 parent bed5390 commit 86cb666

17 files changed

+441
-121
lines changed

Core/FeatureFlag.swift

+32-1
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,30 @@ public enum FeatureFlag: String {
6969

7070
/// https://app.asana.com/0/72649045549333/1208944782348823/f
7171
case syncSeamlessAccountSwitching
72+
73+
case testExperiment
7274
}
7375

7476
extension FeatureFlag: FeatureFlagDescribing {
77+
public var cohortType: (any FeatureFlagCohortDescribing.Type)? {
78+
switch self {
79+
case .privacyProFreeTrialJan25:
80+
PrivacyProFreeTrialExperimentCohort.self
81+
case .testExperiment:
82+
TestExperimentCohort.self
83+
default:
84+
nil
85+
}
86+
}
7587

7688
public static var localOverrideStoreName: String = "com.duckduckgo.app.featureFlag.localOverrides"
7789

7890
public var supportsLocalOverriding: Bool {
7991
switch self {
92+
case .textZoom:
93+
return true
94+
case .testExperiment:
95+
return true
8096
default:
8197
return false
8298
}
@@ -145,7 +161,7 @@ extension FeatureFlag: FeatureFlagDescribing {
145161
case .crashReportOptInStatusResetting:
146162
return .internalOnly()
147163
case .privacyProFreeTrialJan25:
148-
return .remoteDevelopment(.subfeature(PrivacyProSubfeature.privacyProFreeTrialJan25))
164+
return .remoteReleasable(.subfeature(PrivacyProSubfeature.privacyProFreeTrialJan25))
149165
case .aiChat:
150166
return .remoteReleasable(.feature(.aiChat))
151167
case .aiChatDeepLink:
@@ -156,6 +172,8 @@ extension FeatureFlag: FeatureFlagDescribing {
156172
return .remoteReleasable(.feature(.webViewStateRestoration))
157173
case .syncSeamlessAccountSwitching:
158174
return .remoteReleasable(.subfeature(SyncSubfeature.seamlessAccountSwitching))
175+
case .testExperiment:
176+
return .remoteReleasable(.subfeature(ExperimentTestSubfeatures.experimentTestAA))
159177
}
160178
}
161179
}
@@ -164,4 +182,17 @@ extension FeatureFlagger {
164182
public func isFeatureOn(_ featureFlag: FeatureFlag) -> Bool {
165183
return isFeatureOn(for: featureFlag)
166184
}
185+
186+
}
187+
188+
public enum PrivacyProFreeTrialExperimentCohort: String, FeatureFlagCohortDescribing {
189+
/// Control cohort with no changes applied.
190+
case control
191+
/// Treatment cohort where the experiment modifications are applied.
192+
case treatment
193+
}
194+
195+
public enum TestExperimentCohort: String, FeatureFlagCohortDescribing {
196+
case control
197+
case treatment
167198
}

DuckDuckGo-iOS.xcodeproj/project.pbxproj

+21-1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@
286286
563A3CFE2D37B8FA001966FD /* ConfigurationManagerIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563A3CFD2D37B8FA001966FD /* ConfigurationManagerIntegrationTests.swift */; };
287287
563A3D012D37BF83001966FD /* ConfigurationManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563A3D002D37BF83001966FD /* ConfigurationManagerTests.swift */; };
288288
563A3D032D37C363001966FD /* AppConfigurationURLProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563A3D022D37C363001966FD /* AppConfigurationURLProviderTests.swift */; };
289+
5644419D2D4D1EDD003C53B8 /* FeatureFlagsMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644419C2D4D1EDD003C53B8 /* FeatureFlagsMenuView.swift */; };
290+
5644419F2D4D205C003C53B8 /* FeatureFlagsSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644419E2D4D205C003C53B8 /* FeatureFlagsSettingViewModel.swift */; };
291+
564441A22D4D20D6003C53B8 /* ExperimentCohortView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564441A12D4D20D6003C53B8 /* ExperimentCohortView.swift */; };
289292
564DE4532C3ED1B700D23241 /* NewTabDaxDialogFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564DE4522C3ED1B700D23241 /* NewTabDaxDialogFactory.swift */; };
290293
564DE4552C3EDEF200D23241 /* ContextualOnboardingNewTabDialogFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564DE4542C3EDEF200D23241 /* ContextualOnboardingNewTabDialogFactoryTests.swift */; };
291294
564DE4572C4150E600D23241 /* NewTabPageControllerDaxDialogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564DE4562C4150E600D23241 /* NewTabPageControllerDaxDialogTests.swift */; };
@@ -1697,6 +1700,9 @@
16971700
563A3CFD2D37B8FA001966FD /* ConfigurationManagerIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationManagerIntegrationTests.swift; sourceTree = "<group>"; };
16981701
563A3D002D37BF83001966FD /* ConfigurationManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationManagerTests.swift; sourceTree = "<group>"; };
16991702
563A3D022D37C363001966FD /* AppConfigurationURLProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConfigurationURLProviderTests.swift; sourceTree = "<group>"; };
1703+
5644419C2D4D1EDD003C53B8 /* FeatureFlagsMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlagsMenuView.swift; sourceTree = "<group>"; };
1704+
5644419E2D4D205C003C53B8 /* FeatureFlagsSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlagsSettingViewModel.swift; sourceTree = "<group>"; };
1705+
564441A12D4D20D6003C53B8 /* ExperimentCohortView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExperimentCohortView.swift; sourceTree = "<group>"; };
17001706
564DE4522C3ED1B700D23241 /* NewTabDaxDialogFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabDaxDialogFactory.swift; sourceTree = "<group>"; };
17011707
564DE4542C3EDEF200D23241 /* ContextualOnboardingNewTabDialogFactoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualOnboardingNewTabDialogFactoryTests.swift; sourceTree = "<group>"; };
17021708
564DE4562C4150E600D23241 /* NewTabPageControllerDaxDialogTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageControllerDaxDialogTests.swift; sourceTree = "<group>"; };
@@ -4102,6 +4108,16 @@
41024108
path = Configuration;
41034109
sourceTree = "<group>";
41044110
};
4111+
564441A02D4D2089003C53B8 /* FeatureFlagsDebugSettings */ = {
4112+
isa = PBXGroup;
4113+
children = (
4114+
5644419E2D4D205C003C53B8 /* FeatureFlagsSettingViewModel.swift */,
4115+
5644419C2D4D1EDD003C53B8 /* FeatureFlagsMenuView.swift */,
4116+
564441A12D4D20D6003C53B8 /* ExperimentCohortView.swift */,
4117+
);
4118+
path = FeatureFlagsDebugSettings;
4119+
sourceTree = "<group>";
4120+
};
41054121
5650E36D2D3E8E3100D41ECF /* PageRefreshMonitor */ = {
41064122
isa = PBXGroup;
41074123
children = (
@@ -4800,6 +4816,7 @@
48004816
858566F1252E55AE007501B8 /* Debug */ = {
48014817
isa = PBXGroup;
48024818
children = (
4819+
564441A02D4D2089003C53B8 /* FeatureFlagsDebugSettings */,
48034820
C1047CA32CA59BDC00B916FD /* Autofill */,
48044821
6FB1FE9C2C24D4060075B68B /* NewTabPageSectionsDebugView */,
48054822
9F9A922F2C86AACB001D036D /* OnboardingDebugView */,
@@ -8110,6 +8127,7 @@
81108127
85DFEDED24C7CCA500973FE7 /* AppWidthObserver.swift in Sources */,
81118128
4B6484F327FD1E350050A7A1 /* MenuControllerView.swift in Sources */,
81128129
7B059F0F2D0387E900371ED0 /* NumberedParagraphView.swift in Sources */,
8130+
5644419F2D4D205C003C53B8 /* FeatureFlagsSettingViewModel.swift in Sources */,
81138131
7B059F112D0387E900371ED0 /* WidgetEducationViewController.swift in Sources */,
81148132
7B059F122D0387E900371ED0 /* WidgetEducationView.swift in Sources */,
81158133
9F9A92342C86B42B001D036D /* AppIconPicker.swift in Sources */,
@@ -8191,6 +8209,7 @@
81918209
CB4FA44E2C78AACE00A16F5A /* SpecialErrorPageUserScript.swift in Sources */,
81928210
EE0153ED2A6FF9E6002A8B26 /* NetworkProtectionRootView.swift in Sources */,
81938211
EEF0F8CC2ABC832300630031 /* NetworkProtectionDebugFeatures.swift in Sources */,
8212+
5644419D2D4D1EDD003C53B8 /* FeatureFlagsMenuView.swift in Sources */,
81948213
CBECDB7A2CD981CE005B8B87 /* AppPageRefreshMonitor.swift in Sources */,
81958214
B60DFF072872B64B0061E7C2 /* JSAlertController.swift in Sources */,
81968215
981FED6E22025151008488D7 /* BlankSnapshotViewController.swift in Sources */,
@@ -8247,6 +8266,7 @@
82478266
85582E0029D7409700E9AE35 /* SyncSettingsViewController+PDFRendering.swift in Sources */,
82488267
9888F77B2224980500C46159 /* FeedbackViewController.swift in Sources */,
82498268
D6E83C662B23936F006C8AFB /* SettingsDebugView.swift in Sources */,
8269+
564441A22D4D20D6003C53B8 /* ExperimentCohortView.swift in Sources */,
82508270
C1641EB12BC2F52B0012607A /* ImportPasswordsView.swift in Sources */,
82518271
CBFCB30E2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift in Sources */,
82528272
6FDC64052C98515E00DB71B3 /* FavoriteAddItemView.swift in Sources */,
@@ -11967,7 +11987,7 @@
1196711987
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit.git";
1196811988
requirement = {
1196911989
kind = exactVersion;
11970-
version = 233.1.0;
11990+
version = 234.0.0;
1197111991
};
1197211992
};
1197311993
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {

DuckDuckGo-iOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"kind" : "remoteSourceControl",
3333
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit.git",
3434
"state" : {
35-
"revision" : "b874310b6db6687ef6be5f978edf2f5d03b7fc69",
36-
"version" : "233.1.0"
35+
"revision" : "4376de073a92ca6c69fcf31c28cfcfaf6b9727d0",
36+
"version" : "234.0.0"
3737
}
3838
},
3939
{

0 commit comments

Comments
 (0)