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

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

@ -50,7 +50,7 @@ class SettingsSubMenuHomepageRobot {
} }
private fun mostVisitedTopSitesButton() = 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() = private fun jumpBackInButton() =
onView(allOf(withText(R.string.customize_toggle_jump_back_in))) onView(allOf(withText(R.string.customize_toggle_jump_back_in)))

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

@ -1248,4 +1248,13 @@ class Settings(private val appContext: Context) : PreferencesHolder {
featureFlag = FeatureFlags.isPocketRecommendationsFeatureEnabled(appContext), featureFlag = FeatureFlags.isPocketRecommendationsFeatureEnabled(appContext),
default = { appContext.components.analytics.features.homeScreen.isPocketRecommendationsActive() }, 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:clickable="true"
android:focusable="true" android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginStart="@dimen/custom_checkbox_alignment_margin"> android:paddingStart="@dimen/custom_checkbox_alignment_margin">
<LinearLayout <LinearLayout
android:id="@android:id/widget_frame" 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> <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 --> <!-- 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> <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 --> <!-- 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> <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> <string name="customize_toggle_pocket">Pocket</string>
<!-- Title for the opening wallpaper settings screen --> <!-- Title for the opening wallpaper settings screen -->
<string name="customize_wallpapers">Wallpapers</string> <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 --> <!-- Wallpapers -->
<!-- Content description for various wallpapers. The first parameter is the name of the wallpaper --> <!-- 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> <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. --> <!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">OK, Got It</string> <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 --> <!-- 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">Most visited top sites</string> <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. --> <!-- Title text displayed in the rename top site dialog. -->
<string name="top_sites_rename_dialog_title">Name</string> <string name="top_sites_rename_dialog_title">Name</string>
<!-- Hint for renaming title of a top site --> <!-- Hint for renaming title of a top site -->

@ -7,7 +7,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.SwitchPreference <androidx.preference.SwitchPreference
android:key="@string/pref_key_enable_top_frecent_sites" 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 <androidx.preference.SwitchPreference
android:key="@string/pref_key_recent_tabs" android:key="@string/pref_key_recent_tabs"

Loading…
Cancel
Save