For #23159 - Created setting to turn off the Contile feature

upstream-sync
Noah Bond 2 years ago committed by mergify[bot]
parent ce6917a542
commit 157acdf7fc

@ -50,7 +50,7 @@ class SettingsSubMenuHomepageRobot {
}
private fun mostVisitedTopSitesButton() =
onView(allOf(withText(R.string.top_sites_toggle_top_recent_sites_3)))
onView(allOf(withText(R.string.top_sites_toggle_top_recent_sites_4)))
private fun jumpBackInButton() =
onView(allOf(withText(R.string.customize_toggle_jump_back_in)))

@ -5,6 +5,7 @@
package org.mozilla.fenix.settings
import android.os.Bundle
import androidx.preference.CheckBoxPreference
import androidx.navigation.findNavController
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
@ -39,6 +40,12 @@ class HomeSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = CustomizeHomeMetricsUpdater()
}
requirePreference<CheckBoxPreference>(R.string.pref_key_enable_contile).apply {
isVisible = FeatureFlags.contileFeature
isChecked = context.settings().showContileFeature
onPreferenceChangeListener = CustomizeHomeMetricsUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_recent_tabs).apply {
isVisible = FeatureFlags.showRecentTabsFeature
isChecked = context.settings().showRecentTabsFeature

@ -1248,4 +1248,13 @@ class Settings(private val appContext: Context) : PreferencesHolder {
featureFlag = FeatureFlags.isPocketRecommendationsFeatureEnabled(appContext),
default = { appContext.components.analytics.features.homeScreen.isPocketRecommendationsActive() },
)
/**
* Indicates if the Contile functionality should be visible.
*/
var showContileFeature by featureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_enable_contile),
default = false,
featureFlag = FeatureFlags.contileFeature,
)
}

@ -12,7 +12,7 @@
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:layout_marginStart="@dimen/custom_checkbox_alignment_margin">
android:paddingStart="@dimen/custom_checkbox_alignment_margin">
<LinearLayout
android:id="@android:id/widget_frame"

@ -200,6 +200,8 @@
<string name="pref_key_top_sites_max_limit" translatable="false">pref_key_top_sites_max_limit</string>
<!-- Whether or not the top frecent sites are shown along with pinned top sites -->
<string name="pref_key_enable_top_frecent_sites" translatable="false">pref_key_top_frecent_sites</string>
<!-- Whether or not the sponsored shortcuts are shown along with the top recent sites shortcuts -->
<string name="pref_key_enable_contile" translatable="false">pref_key_contile</string>
<!-- A value of `true` means the PWA dialog has been showed or user already has PWAs installed -->
<string name="pref_key_user_knows_about_pwa" translatable="false">pref_key_user_knows_about_pwa</string>

@ -454,6 +454,8 @@
<string name="customize_toggle_pocket">Pocket</string>
<!-- Title for the opening wallpaper settings screen -->
<string name="customize_wallpapers">Wallpapers</string>
<!-- Title for the customize home screen section with sponsored shortcuts. -->
<string name="customize_toggle_contile">Sponsored shortcuts</string>
<!-- Wallpapers -->
<!-- Content description for various wallpapers. The first parameter is the name of the wallpaper -->
@ -1883,8 +1885,10 @@
<string name="top_sites_max_limit_content_2">To add a new top site, remove one. Touch and hold the site and select remove.</string>
<!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">OK, Got It</string>
<!-- Label for the preference to show the most visited top sites on the homepage -->
<string name="top_sites_toggle_top_recent_sites_3">Most visited top sites</string>
<!-- Label for the preference to show the shortcuts for the most visited top sites on the homepage -->
<string name="top_sites_toggle_top_recent_sites_3" moz:removedIn="98" tools:ignore="UnusedResources">Most visited top sites</string>
<!-- Label for the preference to show the shortcuts for the most visited top sites on the homepage -->
<string name="top_sites_toggle_top_recent_sites_4">Shortcuts</string>
<!-- Title text displayed in the rename top site dialog. -->
<string name="top_sites_rename_dialog_title">Name</string>
<!-- Hint for renaming title of a top site -->

@ -7,7 +7,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.SwitchPreference
android:key="@string/pref_key_enable_top_frecent_sites"
android:title="@string/top_sites_toggle_top_recent_sites_3" />
android:title="@string/top_sites_toggle_top_recent_sites_4" />
<androidx.preference.CheckBoxPreference
android:dependency="@string/pref_key_enable_top_frecent_sites"
android:layout="@layout/checkbox_left_sub_preference"
android:key="@string/pref_key_enable_contile"
android:title="@string/customize_toggle_contile"
app:isPreferenceVisible="false" />
<androidx.preference.SwitchPreference
android:key="@string/pref_key_recent_tabs"

Loading…
Cancel
Save