From f7b64223d065655ce6dc98bfc3fecdf956ed1e5b Mon Sep 17 00:00:00 2001 From: t-p-white Date: Mon, 26 Jun 2023 12:19:53 +0100 Subject: [PATCH] Bug 1840382 - Add experimentation flag to enable passing a channel ID to use for search --- app/.experimenter.yaml | 11 +++++++++++ app/nimbus.fml.yaml | 11 +++++++++++ .../main/java/org/mozilla/fenix/components/Core.kt | 12 +++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/.experimenter.yaml b/app/.experimenter.yaml index 2746cdd96e..aca712aaf3 100644 --- a/app/.experimenter.yaml +++ b/app/.experimenter.yaml @@ -147,6 +147,17 @@ search-term-groups: enabled: type: boolean description: "If true, the feature shows up on the homescreen and on the new tab screen." +search_extra_params: + description: A feature that provides a search engine name and a channel ID. + hasExposure: true + exposureDescription: "" + variables: + enabled: + type: boolean + description: "If true, the feature is active." + search_name_channel_id: + type: json + description: The search engine name and the channel ID. shopping-experience: description: A feature that shows product review quality information. hasExposure: true diff --git a/app/nimbus.fml.yaml b/app/nimbus.fml.yaml index 71991e95e5..f5ef658652 100644 --- a/app/nimbus.fml.yaml +++ b/app/nimbus.fml.yaml @@ -342,6 +342,17 @@ features: value: enabled: true + search_extra_params: + description: A feature that provides a search engine name and a channel ID. + variables: + enabled: + description: If true, the feature is active. + type: Boolean + default: false + search_name_channel_id: + description: The search engine name and the channel ID. + type: Map + default: {} types: objects: {} diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index b620c393fe..f44d928687 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -52,6 +52,7 @@ import mozilla.components.feature.recentlyclosed.RecentlyClosedMiddleware import mozilla.components.feature.recentlyclosed.RecentlyClosedTabsStorage import mozilla.components.feature.search.ext.createApplicationSearchEngine import mozilla.components.feature.search.middleware.AdsTelemetryMiddleware +import mozilla.components.feature.search.middleware.SearchExtraParams import mozilla.components.feature.search.middleware.SearchMiddleware import mozilla.components.feature.search.region.RegionMiddleware import mozilla.components.feature.search.telemetry.ads.AdsTelemetry @@ -95,6 +96,7 @@ import org.mozilla.fenix.historymetadata.DefaultHistoryMetadataService import org.mozilla.fenix.historymetadata.HistoryMetadataMiddleware import org.mozilla.fenix.historymetadata.HistoryMetadataService import org.mozilla.fenix.media.MediaSessionService +import org.mozilla.fenix.nimbus.FxNimbus import org.mozilla.fenix.perf.StrictModeManager import org.mozilla.fenix.perf.lazyMonitored import org.mozilla.fenix.settings.SupportUtils @@ -257,9 +259,17 @@ class Core( UndoMiddleware(context.getUndoDelay()), RegionMiddleware(context, locationService), SearchMiddleware( - context, + context = context, additionalBundledSearchEngineIds = listOf("reddit", "youtube"), migration = SearchMigration(context), + searchExtraParams = + FxNimbus.features.searchExtraParams.value().searchNameChannelId + .firstNotNullOfOrNull { + SearchExtraParams( + it.key, + it.value, + ) + }, ), RecordingDevicesMiddleware(context, context.components.notificationsDelegate), PromptMiddleware(),