mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[SDK-279] Adds a way to switch to the "preview" collection in Nimbus
This adds a toggle/switch to the debug settings menu that causes Nimbus to use the "preview" collection rather than the "main" collection when it initializes. Since it is only applied during init, it does require a restart in order to take effect.
This commit is contained in:
parent
9d9761e267
commit
a2984e6863
@ -31,7 +31,11 @@ fun createNimbus(context: Context, url: String?): NimbusApi {
|
|||||||
// Eventually we'll want to use `NimbusDisabled` when we have no NIMBUS_ENDPOINT.
|
// Eventually we'll want to use `NimbusDisabled` when we have no NIMBUS_ENDPOINT.
|
||||||
// but we keep this here to not mix feature flags and how we configure Nimbus.
|
// but we keep this here to not mix feature flags and how we configure Nimbus.
|
||||||
val serverSettings = if (!url.isNullOrBlank()) {
|
val serverSettings = if (!url.isNullOrBlank()) {
|
||||||
|
if (context.settings().nimbusUsePreview) {
|
||||||
|
NimbusServerSettings(url = Uri.parse(url), collection = "nimbus-preview")
|
||||||
|
} else {
|
||||||
NimbusServerSettings(url = Uri.parse(url))
|
NimbusServerSettings(url = Uri.parse(url))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,11 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requirePreference<SwitchPreference>(R.string.pref_key_nimbus_use_preview).apply {
|
||||||
|
isVisible = true
|
||||||
|
isChecked = context.settings().nimbusUsePreview
|
||||||
|
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||||||
default = false
|
default = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var nimbusUsePreview by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_nimbus_use_preview),
|
||||||
|
default = false
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates the last time when the user was interacting with the [BrowserFragment],
|
* Indicates the last time when the user was interacting with the [BrowserFragment],
|
||||||
* This is useful to determine if the user has to start on the [HomeFragment]
|
* This is useful to determine if the user has to start on the [HomeFragment]
|
||||||
|
@ -284,4 +284,5 @@
|
|||||||
<!-- Secret Settings -->
|
<!-- Secret Settings -->
|
||||||
<string name="pref_key_show_address_feature" translatable="false">pref_key_show_address_feature</string>
|
<string name="pref_key_show_address_feature" translatable="false">pref_key_show_address_feature</string>
|
||||||
<string name="pref_key_nimbus_experiments" translatable="false">pref_key_nimbus_experiments</string>
|
<string name="pref_key_nimbus_experiments" translatable="false">pref_key_nimbus_experiments</string>
|
||||||
|
<string name="pref_key_nimbus_use_preview" translatable="false">pref_key_nimbus_use_preview</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1764,5 +1764,6 @@
|
|||||||
|
|
||||||
<!-- Content description for privacy content close button -->
|
<!-- Content description for privacy content close button -->
|
||||||
<string name="privacy_content_close_button_content_description">Close</string>
|
<string name="privacy_content_close_button_content_description">Close</string>
|
||||||
|
<string name="mozac_service_nimbus_use_preview_collection">Use Nimbus Preview Collection (requires restart)</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -15,4 +15,9 @@
|
|||||||
android:title="@string/preferences_debug_settings_allow_third_party_root_certs"
|
android:title="@string/preferences_debug_settings_allow_third_party_root_certs"
|
||||||
android:summary="@string/preferences_debug_settings_allow_third_party_root_certs_summary"
|
android:summary="@string/preferences_debug_settings_allow_third_party_root_certs_summary"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/pref_key_nimbus_use_preview"
|
||||||
|
android:title="@string/mozac_service_nimbus_use_preview_collection"
|
||||||
|
app:iconSpaceReserved="false" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user