For #8967 - Expose autofill logins setting in nightly
This commit is contained in:
parent
29e1a9c670
commit
6d4a673c6f
|
@ -169,6 +169,7 @@ class SettingsPrivacyTest {
|
|||
}.openLoginsAndPasswordSubMenu {
|
||||
verifyDefaultView()
|
||||
verifyDefaultValueSyncLogins()
|
||||
verifyDefaultValueAutofillLogins()
|
||||
}.openSavedLogins {
|
||||
verifySavedLoginsView()
|
||||
tapSetupLater()
|
||||
|
|
|
@ -38,7 +38,9 @@ class SettingsSubMenuLoginsAndPasswordRobot {
|
|||
mDevice.waitNotNull(Until.findObjects(By.text("On")), TestAssetHelper.waitingTime)
|
||||
}
|
||||
|
||||
fun verifyDefaultValueSyncLogins() = asserDefaultValueSyncLogins()
|
||||
fun verifyDefaultValueAutofillLogins() = assertDefaultValueAutofillLogins()
|
||||
|
||||
fun verifyDefaultValueSyncLogins() = assertDefaultValueSyncLogins()
|
||||
|
||||
class Transition {
|
||||
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
|
@ -87,5 +89,8 @@ private fun goBackButton() =
|
|||
private fun assertDefaultView() = onView(ViewMatchers.withText("Sync logins"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun asserDefaultValueSyncLogins() = onView(ViewMatchers.withText("Sign in to Sync"))
|
||||
private fun assertDefaultValueAutofillLogins() = onView(ViewMatchers.withText("Autofill"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertDefaultValueSyncLogins() = onView(ViewMatchers.withText("Sign in to Sync"))
|
||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
|
|
@ -10,7 +10,6 @@ import mozilla.components.concept.storage.LoginsStorage
|
|||
import mozilla.components.lib.crash.handler.CrashHandlerService
|
||||
import mozilla.components.service.sync.logins.GeckoLoginStorageDelegate
|
||||
import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import org.mozilla.geckoview.GeckoRuntime
|
||||
import org.mozilla.geckoview.GeckoRuntimeSettings
|
||||
|
@ -56,11 +55,7 @@ object GeckoProvider {
|
|||
}
|
||||
|
||||
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
||||
// As a quick fix for #8967 we are conflating "should autofill" with "should save logins"
|
||||
val loginStorageDelegate = GeckoLoginStorageDelegate(
|
||||
storage,
|
||||
{ context.settings().shouldPromptToSaveLogins }
|
||||
)
|
||||
val loginStorageDelegate = GeckoLoginStorageDelegate(storage, { true })
|
||||
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
||||
|
||||
return geckoRuntime
|
||||
|
|
|
@ -76,7 +76,8 @@ class Core(private val context: Context) {
|
|||
automaticFontSizeAdjustment = context.settings().shouldUseAutoSize,
|
||||
fontInflationEnabled = context.settings().shouldUseAutoSize,
|
||||
suspendMediaWhenInactive = false,
|
||||
forceUserScalableContent = context.settings().forceEnableZoom
|
||||
forceUserScalableContent = context.settings().forceEnableZoom,
|
||||
loginAutofillEnabled = context.settings().shouldAutofillLogins
|
||||
)
|
||||
|
||||
GeckoEngine(
|
||||
|
|
|
@ -30,6 +30,7 @@ import mozilla.components.concept.sync.AuthType
|
|||
import mozilla.components.concept.sync.OAuthAccount
|
||||
import mozilla.components.service.fxa.SyncEngine
|
||||
import mozilla.components.service.fxa.manager.SyncEnginesStorage
|
||||
import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
|
@ -112,11 +113,17 @@ class SavedLoginsAuthFragment : PreferenceFragmentCompat(), AccountObserver {
|
|||
|
||||
val autofillPreferenceKey = getPreferenceKey(R.string.pref_key_autofill_logins)
|
||||
findPreference<SwitchPreference>(autofillPreferenceKey)?.apply {
|
||||
isEnabled = context.settings().shouldPromptToSaveLogins
|
||||
isChecked =
|
||||
context.settings().shouldAutofillLogins && context.settings().shouldPromptToSaveLogins
|
||||
onPreferenceChangeListener =
|
||||
SharedPreferenceUpdater()
|
||||
// The ability to toggle autofill on the engine is only available in Nightly currently
|
||||
// See https://github.com/mozilla-mobile/fenix/issues/11320
|
||||
isVisible = Config.channel.isNightlyOrDebug
|
||||
isChecked = context.settings().shouldAutofillLogins
|
||||
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||
context?.components?.core?.engine?.settings?.loginAutofillEnabled =
|
||||
newValue as Boolean
|
||||
return super.onPreferenceChange(preference, newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val savedLoginsKey = getPreferenceKey(R.string.pref_key_saved_logins)
|
||||
|
|
|
@ -217,6 +217,19 @@ class SettingsTest {
|
|||
assertFalse(settings.shouldUseAutoSize)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldAutofill() {
|
||||
// When just created
|
||||
// Then
|
||||
assertTrue(settings.shouldAutofillLogins)
|
||||
|
||||
// When
|
||||
settings.shouldAutofillLogins = false
|
||||
|
||||
// Then
|
||||
assertFalse(settings.shouldAutofillLogins)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fontSizeFactor() {
|
||||
// When just created
|
||||
|
|
Loading…
Reference in New Issue
Block a user