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