Bug 1868539 - Add method of changing remote server url

fenix/124.1.0
sarah541 4 months ago committed by mergify[bot]
parent 5bc7208970
commit f8edd00fe1

@ -329,6 +329,11 @@ class Core(
rootStorageDirectory = context.filesDir,
readJson = readJson,
collectionName = COLLECTION_NAME,
serverUrl = if (context.settings().useProductionRemoteSettingsServer) {
REMOTE_PROD_ENDPOINT_URL
} else {
REMOTE_STAGE_ENDPOINT_URL
},
).updateProviderList()
}
// Install the "ads" WebExtension to get the links in an partner page.
@ -623,5 +628,7 @@ class Core(
// collection name to fetch from server for SERP telemetry
const val COLLECTION_NAME = "search-telemetry-v2"
internal const val REMOTE_PROD_ENDPOINT_URL = "https://firefox.settings.services.mozilla.com"
internal const val REMOTE_STAGE_ENDPOINT_URL = "https://firefox.settings.services.allizom.org"
}
}

@ -88,7 +88,8 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = object : Preference.OnPreferenceChangeListener {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
val newBooleanValue = newValue as? Boolean ?: return false
val ingestionScheduler = requireContext().components.fxSuggest.ingestionScheduler
val ingestionScheduler =
requireContext().components.fxSuggest.ingestionScheduler
if (newBooleanValue) {
ingestionScheduler.startPeriodicIngestion()
} else {
@ -129,6 +130,12 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
requirePreference<Preference>(R.string.pref_key_custom_sponsored_stories_parameters).apply {
isVisible = Config.channel.isNightlyOrDebug
}
requirePreference<SwitchPreference>(R.string.pref_key_remote_server_prod).apply {
isVisible = true
isChecked = context.settings().useProductionRemoteSettingsServer
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
override fun onPreferenceTreeClick(preference: Preference): Boolean {

@ -767,6 +767,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
true,
)
val useProductionRemoteSettingsServer by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_remote_server_prod),
default = true,
)
val enabledTotalCookieProtection: Boolean
get() = mr2022Sections[Mr2022Section.TCP_FEATURE] == true

@ -145,6 +145,9 @@
<!-- Privacy Pop Window -->
<string name="pref_key_privacy_pop_window" translatable="false">pref_key_privacy_pop_window</string>
<!-- Remote Server Settings -->
<string name="pref_key_remote_server_prod" translatable="false">pref_key_remote_server_prod</string>
<!-- Theme Settings -->
<string name="pref_key_light_theme" translatable="false">pref_key_light_theme</string>
<string name="pref_key_dark_theme" translatable="false">pref_key_dark_theme</string>

@ -34,6 +34,8 @@
<string name="preferences_debug_settings">Secret Settings</string>
<!-- Label for the secret settings preference -->
<string name="preferences_debug_info" translatable="false">Secret Debug Info</string>
<!-- Label for using remote settings server url -->
<string name="preferences_debug_settings_remote_settings_server" translatable="false">Use Remote Settings Production server \n(Staging will be used when disabled) \n(requires restart)</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 -->

@ -61,4 +61,9 @@
app:iconSpaceReserved="false"
android:title="@string/preferences_debug_settings_custom_sponsored_stories_parameters"
/>
<SwitchPreference
android:key="@string/pref_key_remote_server_prod"
app:iconSpaceReserved="false"
android:title="@string/preferences_debug_settings_remote_settings_server"
/>
</PreferenceScreen>

Loading…
Cancel
Save