For #24334 - Add FeatureFlag for Unified Search feature

upstream-sync
Gabriel Luong 2 years ago committed by mergify[bot]
parent c1d2a9fb70
commit b4725429e8

@ -104,4 +104,9 @@ object FeatureFlags {
* Enables the Task Continuity enhancements. * Enables the Task Continuity enhancements.
*/ */
val taskContinuityFeature = Config.channel.isDebug val taskContinuityFeature = Config.channel.isDebug
/**
* Enables the Unified Search feature.
*/
val unifiedSearchFeature = Config.channel.isNightlyOrDebug
} }

@ -53,7 +53,7 @@ interface ToolbarInteractor {
@Suppress("LongParameterList") @Suppress("LongParameterList")
class ToolbarView( class ToolbarView(
private val context: Context, private val context: Context,
settings: Settings, private val settings: Settings,
private val interactor: ToolbarInteractor, private val interactor: ToolbarInteractor,
private val historyStorage: HistoryStorage?, private val historyStorage: HistoryStorage?,
private val isPrivate: Boolean, private val isPrivate: Boolean,
@ -152,7 +152,7 @@ class ToolbarView(
val searchEngine = searchState.searchEngineSource.searchEngine val searchEngine = searchState.searchEngineSource.searchEngine
if (searchEngine != null) { if (!settings.showUnifiedSearchFeature && searchEngine != null) {
val iconSize = val iconSize =
context.resources.getDimensionPixelSize(R.dimen.preference_icon_drawable_size) context.resources.getDimensionPixelSize(R.dimen.preference_icon_drawable_size)

@ -59,5 +59,11 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
isChecked = context.settings().enableTaskContinuityEnhancements isChecked = context.settings().enableTaskContinuityEnhancements
onPreferenceChangeListener = SharedPreferenceUpdater() onPreferenceChangeListener = SharedPreferenceUpdater()
} }
requirePreference<SwitchPreference>(R.string.pref_key_show_unified_search).apply {
isVisible = FeatureFlags.unifiedSearchFeature
isChecked = context.settings().showUnifiedSearchFeature
onPreferenceChangeListener = SharedPreferenceUpdater()
}
} }
} }

@ -1290,6 +1290,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
featureFlag = FeatureFlags.taskContinuityFeature, featureFlag = FeatureFlags.taskContinuityFeature,
) )
/**
* Indicates if the Unified Search feature should be visible.
*/
var showUnifiedSearchFeature by featureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_show_unified_search),
default = false,
featureFlag = FeatureFlags.unifiedSearchFeature
)
/** /**
* Blocklist used to filter items from the home screen that have previously been removed. * Blocklist used to filter items from the home screen that have previously been removed.
*/ */

@ -282,4 +282,5 @@
<string name="pref_key_nimbus_use_preview" translatable="false">pref_key_nimbus_use_preview</string> <string name="pref_key_nimbus_use_preview" translatable="false">pref_key_nimbus_use_preview</string>
<string name="pref_key_history_metadata_feature" translatable="false">pref_key_history_metadata_feature</string> <string name="pref_key_history_metadata_feature" translatable="false">pref_key_history_metadata_feature</string>
<string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string> <string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string>
<string name="pref_key_show_unified_search" translatable="false">pref_key_show_unified_search</string>
</resources> </resources>

@ -45,6 +45,8 @@
<string name="preferences_nimbus_use_preview_collection">Use Nimbus Preview Collection (requires restart)</string> <string name="preferences_nimbus_use_preview_collection">Use Nimbus Preview Collection (requires restart)</string>
<!-- Label for enabling the Task Continuity feature --> <!-- Label for enabling the Task Continuity feature -->
<string name="preferences_debug_settings_task_continuity" translatable="false">Enable Task Continuity</string> <string name="preferences_debug_settings_task_continuity" translatable="false">Enable Task Continuity</string>
<!-- Label for enabling the Unified Search feature -->
<string name="preferences_debug_settings_unified_search" translatable="false">Enable Unified Search</string>
<!-- A secret menu option in the tabs tray for making a tab inactive for testing. --> <!-- A secret menu option in the tabs tray for making a tab inactive for testing. -->
<string name="inactive_tabs_menu_item">Make inactive</string> <string name="inactive_tabs_menu_item">Make inactive</string>

@ -30,4 +30,9 @@
android:key="@string/pref_key_enable_task_continuity" android:key="@string/pref_key_enable_task_continuity"
android:title="@string/preferences_debug_settings_task_continuity" android:title="@string/preferences_debug_settings_task_continuity"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_show_unified_search"
android:title="@string/preferences_debug_settings_unified_search"
app:iconSpaceReserved="false" />
</PreferenceScreen> </PreferenceScreen>

Loading…
Cancel
Save