For #18198 - Add a feature flag for Credit Cards and Addresses autofill feature (#18200)

upstream-sync
Gabriel Luong 3 years ago committed by GitHub
parent 607d6382f8
commit 968b7bfc78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,16 @@ object FeatureFlags {
*/
val nimbusExperiments = Config.channel.isNightlyOrDebug
/**
* Enables the Addresses autofill feature.
*/
val addressesFeature = Config.channel.isNightlyOrDebug
/**
* Enables the Credit Cards autofill feature.
*/
val creditCardsFeature = Config.channel.isNightlyOrDebug
/**
* Enables WebAuthn support.
*/

@ -22,6 +22,18 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.secret_settings_preferences, rootKey)
requirePreference<SwitchPreference>(R.string.pref_key_show_address_feature).apply {
isVisible = FeatureFlags.addressesFeature
isChecked = context.settings().addressFeature
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_show_credit_cards_feature).apply {
isVisible = FeatureFlags.creditCardsFeature
isChecked = context.settings().creditCardsFeature
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_new_tabs_tray).apply {
isVisible = FeatureFlags.tabsTrayRewrite
isChecked = context.settings().tabsTrayRewrite

@ -976,4 +976,16 @@ class Settings(private val appContext: Context) : PreferencesHolder {
appContext.getPreferenceKey(R.string.pref_key_swipe_toolbar_switch_tabs),
default = true
)
var creditCardsFeature by featureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_show_credit_cards_feature),
default = false,
featureFlag = FeatureFlags.creditCardsFeature
)
var addressFeature by featureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_show_address_feature),
default = false,
featureFlag = FeatureFlags.addressesFeature
)
}

@ -241,11 +241,15 @@
<string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string>
<string name="pref_key_return_to_browser" translatable="false">pref_key_return_to_browser</string>
<!-- Secret Info Setting Keys -->
<string name="pref_key_secret_debug_info" translatable="false">pref_key_secret_debug_info</string>
<string name="pref_key_leanplum_user_id" translatable="false">pref_key_leanplum_user_id</string>
<string name="pref_key_leanplum_device_id" translatable="false">pref_key_leanplum_device_id</string>
<string name="pref_key_search_region_home" translatable="false">pref_key_search_region_home</string>
<string name="pref_key_search_region_current" translatable="false">pref_key_search_region_current</string>
<!-- Secret Settings -->
<string name="pref_key_show_credit_cards_feature" translatable="false">pref_key_show_credit_cards_feature</string>
<string name="pref_key_show_address_feature" translatable="false">pref_key_show_address_feature</string>
</resources>

@ -30,15 +30,19 @@
<!-- Application Services abbreviation used in AboutFragment -->
<string name="app_services_abbreviation" translatable="false">AS</string>
<!-- Secret Settings Strings -->
<!-- Label for the secret settings preference -->
<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 enabling Address Autofill -->
<string name="preferences_debug_settings_enable_address_feature" translatable="false">Enable Address Autofill</string>
<!-- Label for enabling Credit Card Autofill -->
<string name="preferences_debug_settings_enable_credit_cards_feature" translatable="false">Enable Credit Card Autofill</string>
<!-- Label for the new tabs tray preference -->
<string name="preferences_debug_settings_tabs_tray_rewrite">Use new Tabs Tray</string>
<!-- Label for a longer description of the new tabs tray preference -->
<string name="preferences_debug_settings_tabs_tray_rewrite_summary">A refactored tabs tray that will include Synced Tabs.</string>
<!-- Label for showing Synced Tabs in the tabs tray -->
<string name="preferences_debug_synced_tabs_tabs_tray">Show Synced Tabs in the tabs tray</string>

@ -4,6 +4,16 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_show_address_feature"
android:title="@string/preferences_debug_settings_enable_address_feature"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_show_credit_cards_feature"
android:title="@string/preferences_debug_settings_enable_credit_cards_feature"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_new_tabs_tray"

Loading…
Cancel
Save