2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/24334 - Add FeatureFlag for Unified Search feature

This commit is contained in:
Gabriel Luong 2022-03-16 22:44:23 -04:00 committed by mergify[bot]
parent 20f4564cfb
commit fa34f4f53e
7 changed files with 30 additions and 2 deletions

View File

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

View File

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

View File

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

View File

@ -1290,6 +1290,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
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.
*/

View File

@ -282,4 +282,5 @@
<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_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>

View File

@ -45,6 +45,8 @@
<string name="preferences_nimbus_use_preview_collection">Use Nimbus Preview Collection (requires restart)</string>
<!-- Label for enabling the Task Continuity feature -->
<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. -->
<string name="inactive_tabs_menu_item">Make inactive</string>

View File

@ -30,4 +30,9 @@
android:key="@string/pref_key_enable_task_continuity"
android:title="@string/preferences_debug_settings_task_continuity"
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>