For #23304 - Add a setting for enabling Contile

upstream-sync
Gabriel Luong 2 years ago committed by mergify[bot]
parent 0316ca434a
commit 70882179a0

@ -95,7 +95,7 @@ object FeatureFlags {
/**
* Enables the Contile top sites.
*/
const val contileFeature = false
val contileFeature = Config.channel.isDebug
/**
* Enables history improvement features.

@ -68,7 +68,6 @@ import mozilla.components.support.locale.LocaleManager
import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.components.search.SearchMigration
@ -410,7 +409,7 @@ class Core(
DefaultTopSitesStorage(
pinnedSitesStorage = pinnedSiteStorage,
historyStorage = historyStorage,
topSitesProvider = if (FeatureFlags.contileFeature) contileTopSitesProvider else null,
topSitesProvider = if (context.settings().showContileFeature) contileTopSitesProvider else null,
defaultTopSites = defaultTopSites
)
}

@ -5,9 +5,6 @@
package org.mozilla.fenix.settings
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.Toast
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
@ -16,7 +13,6 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
import kotlin.system.exitProcess
class SecretSettingsFragment : PreferenceFragmentCompat() {
@ -34,29 +30,10 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_history_metadata_feature).apply {
isVisible = true
isChecked = context.settings().historyMetadataUIFeature
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
val result = super.onPreferenceChange(preference, newValue)
Toast.makeText(
context,
getString(R.string.toast_history_metadata_feature_done),
Toast.LENGTH_LONG
).show()
Handler(Looper.getMainLooper()).postDelayed(
{
exitProcess(0)
},
EXIT_DELAY
)
return result
}
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_contile).apply {
isVisible = FeatureFlags.contileFeature
isChecked = context.settings().showContileFeature
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_allow_third_party_root_certs).apply {
@ -77,8 +54,4 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
companion object {
private const val EXIT_DELAY = 3000L
}
}

@ -201,7 +201,7 @@
<!-- 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>
<string name="pref_key_enable_contile" translatable="false">pref_key_enable_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>

@ -33,10 +33,8 @@
<string name="preferences_debug_info" translatable="false">Secret Debug Info</string>
<!-- Label for enabling Address Autofill -->
<string name="preferences_debug_settings_enable_address_feature" translatable="false">Enable Address Autofill</string>
<!-- Label for enabling History Metadata feature -->
<string name="preferences_debug_settings_history_metadata_feature" translatable="false">Enable History Metadata</string>
<!-- Toast shown after confirming the History Metadata feature configuration -->
<string name="toast_history_metadata_feature_done">History Metadata feature modified. Quitting the application to apply changes…</string>
<!-- Label for enabling Contile feature -->
<string name="preferences_debug_settings_contile_feature" translatable="false">Enable Contile</string>
<!-- Label for allowing third party root certificates from the Android OS CA store preference -->
<string name="preferences_debug_settings_allow_third_party_root_certs">Use third party CA certificates</string>
<!-- Label for a longer description of allowing third party root certificates from the Android OS CA store preference -->

@ -11,8 +11,8 @@
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_history_metadata_feature"
android:title="@string/preferences_debug_settings_history_metadata_feature"
android:key="@string/pref_key_enable_contile"
android:title="@string/preferences_debug_settings_contile_feature"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"

Loading…
Cancel
Save