Skip to content

Commit

Permalink
Add FXIOS-10717 [sponsored tiles] Add feature flag for unified ads API (
Browse files Browse the repository at this point in the history
#23441)

* Add feature flag for unified ads

* Forgot to add debugKey
  • Loading branch information
lmarceau authored Nov 28, 2024
1 parent 57009ea commit eb615fa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum NimbusFeatureFlagID: String, CaseIterable {
case searchHighlights
case sentFromFirefox
case splashScreen
case unifiedAds
case unifiedSearch
case toolbarRefactor
case toolbarOneTapNewTab
Expand All @@ -64,6 +65,7 @@ enum NimbusFeatureFlagID: String, CaseIterable {
.toolbarRefactor,
.trackingProtectionRefactor,
.passwordGenerator,
.unifiedAds,
.unifiedSearch:
return rawValue + PrefsKeys.FeatureFlags.DebugSuffixKey
default:
Expand Down Expand Up @@ -127,6 +129,7 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar {
.feltPrivacyFeltDeletion,
.searchHighlights,
.splashScreen,
.unifiedAds,
.unifiedSearch,
.toolbarRefactor,
.toolbarOneTapNewTab,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ final class FeatureFlagsDebugViewController: SettingsTableViewController, Featur
) { [weak self] _ in
self?.reloadView()
},
FeatureFlagsBoolSetting(
with: .unifiedAds,
titleText: format(string: "Enable Unified Ads"),
statusText: format(string: "Toggle to use unified ads API")
) { [weak self] _ in
self?.reloadView()
},
FeatureFlagsBoolSetting(
with: .unifiedSearch,
titleText: format(string: "Enable Unified Search"),
Expand Down
8 changes: 8 additions & 0 deletions firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ final class NimbusFeatureFlagLayer {
case .toolbarRefactor:
return checkToolbarRefactorFeature(from: nimbus)

case .unifiedAds:
return checkUnifiedAdsFeature(from: nimbus)

case .unifiedSearch:
return checkUnifiedSearchFeature(from: nimbus)

Expand Down Expand Up @@ -204,6 +207,11 @@ final class NimbusFeatureFlagLayer {
return config.enabled
}

private func checkUnifiedAdsFeature(from nimbus: FxNimbus) -> Bool {
let config = nimbus.features.unifiedAds.value()
return config.enabled
}

private func checkUnifiedSearchFeature(from nimbus: FxNimbus) -> Bool {
let config = nimbus.features.toolbarRefactorFeature.value()
return config.unifiedSearch
Expand Down
18 changes: 18 additions & 0 deletions firefox-ios/nimbus-features/unifiedAds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The configuration for the unifiedAds feature
features:
unified-ads:
description: >
This property is for managing the roll out of the unified ads API
variables:
enabled:
description: >
If true, we will enable user to use the unified ads API
type: Boolean
default: false
defaults:
- channel: beta
value:
enabled: false
- channel: developer
value:
enabled: false
1 change: 1 addition & 0 deletions firefox-ios/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ include:
- nimbus-features/toolbarRefactorFeature.yaml
- nimbus-features/tosFeature.yaml
- nimbus-features/trackingProtectionRefactor.yaml
- nimbus-features/unifiedAds.yaml
- nimbus-features/zoomFeature.yaml

0 comments on commit eb615fa

Please sign in to comment.