2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Add preference for enabling/disabling Android Autofill from within the app.

This commit is contained in:
Sebastian Kaspari 2021-07-16 16:10:36 +02:00 committed by mergify[bot]
parent 7f6cdd491b
commit 6e4060fa5a
6 changed files with 43 additions and 3 deletions

View File

@ -97,7 +97,7 @@ private fun goBackButton() =
private fun assertDefaultView() = onView(ViewMatchers.withText("Sync logins across devices"))
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
private fun assertDefaultValueAutofillLogins() = onView(ViewMatchers.withText("Autofill"))
private fun assertDefaultValueAutofillLogins() = onView(ViewMatchers.withText("Autofill websites"))
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
private fun assertDefaultValueExceptions() = onView(ViewMatchers.withText("Exceptions"))

View File

@ -58,4 +58,12 @@ object FeatureFlags {
* Identifies and separates the tabs list with a secondary section containing least used tabs.
*/
val inactiveTabs = Config.channel.isNightlyOrDebug
/**
* Enables support for Android Autofill.
*
* In addition to toggling this flag, matching entries in the Android Manifest of the build
* type need to present.
*/
val androidAutofill = Config.channel.isNightlyOrDebug
}

View File

@ -22,8 +22,10 @@ import androidx.preference.SwitchPreference
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mozilla.components.feature.autofill.preference.AutofillPreference
import mozilla.components.service.fxa.SyncEngine
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
@ -39,7 +41,6 @@ import org.mozilla.fenix.settings.requirePreference
@Suppress("TooManyFunctions")
class SavedLoginsAuthFragment : PreferenceFragmentCompat() {
private val biometricPromptFeature = ViewBoundFeatureWrapper<BiometricPromptFeature>()
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -99,6 +100,14 @@ class SavedLoginsAuthFragment : PreferenceFragmentCompat() {
}
}
requirePreference<AutofillPreference>(R.string.pref_key_android_autofill).apply {
update()
if (!FeatureFlags.androidAutofill) {
isVisible = false
}
}
requirePreference<Preference>(R.string.pref_key_login_exceptions).apply {
setOnPreferenceClickListener {
navigateToLoginExceptionFragment()
@ -107,6 +116,14 @@ class SavedLoginsAuthFragment : PreferenceFragmentCompat() {
}
requirePreference<SwitchPreference>(R.string.pref_key_autofill_logins).apply {
title = context.getString(
R.string.preferences_passwords_autofill2,
getString(R.string.app_name)
)
summary = context.getString(
R.string.preferences_passwords_autofill_description,
getString(R.string.app_name)
)
isChecked = context.settings().shouldAutofillLogins
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {

View File

@ -169,6 +169,7 @@
<string name="pref_key_save_logins_settings" translatable="false">pref_key_save_logins_settings</string>
<string name="pref_key_save_logins" translatable="false">pref_key_save_logins</string>
<string name="pref_key_autofill_logins" translatable="false">pref_key_autofill_logins</string>
<string name="pref_key_android_autofill" translatable="false">pref_key_android_autofill</string>
<string name="pref_key_never_save_logins" translatable="false">pref_key_never_save_logins</string>
<string name="pref_key_saved_logins" translatable="false">pref_key_saved_logins</string>
<string name="pref_key_password_sync_logins" translatable="false">pref_key_password_sync_logins</string>

View File

@ -1457,6 +1457,15 @@
<string name="preferences_passwords_save_logins_never_save">Never save</string>
<!-- Preference for autofilling saved logins in Fenix -->
<string name="preferences_passwords_autofill">Autofill</string>
<!-- Preference for autofilling saved logins in Firefox (in web content), %1$s will be replaced with the app name -->
<string name="preferences_passwords_autofill2">Autofill in %1$s</string>
<!-- Description for the preference for autofilling saved logins in Firefox (in web content), %1$s will be replaced with the app name -->
<string name="preferences_passwords_autofill_description">Fill and save usernames and passwords in websites while using %1$s.</string>
<!-- Preference for autofilling logins from Fenix in other apps (e.g. autofilling the Twitter app) -->
<string name="preferences_android_autofill">Autofill in other apps</string>
<!-- Description for the preference for autofilling logins from Fenix in other apps (e.g. autofilling the Twitter app) -->
<string name="preferences_android_autofill_description">Fill usernames and passwords in other apps on your device.</string>
<!-- Preference for syncing saved logins in Fenix -->
<string name="preferences_passwords_sync_logins">Sync logins</string>
<!-- Preference for syncing saved logins in Fenix, when not signed in-->

View File

@ -11,7 +11,12 @@
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_autofill_logins"
android:title="@string/preferences_passwords_autofill" />
android:title="@string/preferences_passwords_autofill2"
android:summary="@string/preferences_passwords_autofill_description" />
<mozilla.components.feature.autofill.preference.AutofillPreference
android:key="@string/pref_key_android_autofill"
android:title="@string/preferences_android_autofill"
android:summary="@string/preferences_android_autofill_description" />
<org.mozilla.fenix.settings.SyncPreference
android:key="@string/pref_key_sync_logins"
android:title="@string/preferences_passwords_sync_logins" />