mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
For #18263 - Allow dynamically toggling credit cards autofill
This commit is contained in:
parent
ac71b47c61
commit
bd8facb025
@ -545,6 +545,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
|
|||||||
isSaveLoginEnabled = {
|
isSaveLoginEnabled = {
|
||||||
context.settings().shouldPromptToSaveLogins
|
context.settings().shouldPromptToSaveLogins
|
||||||
},
|
},
|
||||||
|
isCreditCardAutofillEnabled = {
|
||||||
|
context.settings().shouldAutofillCreditCardDetails
|
||||||
|
},
|
||||||
loginExceptionStorage = context.components.core.loginExceptionStorage,
|
loginExceptionStorage = context.components.core.loginExceptionStorage,
|
||||||
shareDelegate = object : ShareDelegate {
|
shareDelegate = object : ShareDelegate {
|
||||||
override fun showShareSheet(
|
override fun showShareSheet(
|
||||||
|
@ -16,6 +16,7 @@ import mozilla.components.service.sync.autofill.GeckoCreditCardsAddressesStorage
|
|||||||
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.components
|
import org.mozilla.fenix.ext.components
|
||||||
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.geckoview.ContentBlocking
|
import org.mozilla.geckoview.ContentBlocking
|
||||||
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
||||||
import org.mozilla.geckoview.GeckoRuntime
|
import org.mozilla.geckoview.GeckoRuntime
|
||||||
@ -91,7 +92,9 @@ object GeckoProvider {
|
|||||||
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
||||||
|
|
||||||
geckoRuntime.autocompleteStorageDelegate = GeckoAutocompleteStorageDelegate(
|
geckoRuntime.autocompleteStorageDelegate = GeckoAutocompleteStorageDelegate(
|
||||||
GeckoCreditCardsAddressesStorageDelegate(autofillStorage),
|
GeckoCreditCardsAddressesStorageDelegate(autofillStorage) {
|
||||||
|
context.settings().shouldAutofillCreditCardDetails
|
||||||
|
},
|
||||||
GeckoLoginStorageDelegate(loginStorage)
|
GeckoLoginStorageDelegate(loginStorage)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import androidx.navigation.NavController
|
|||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.SwitchPreference
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -23,7 +24,9 @@ import org.mozilla.fenix.R
|
|||||||
import org.mozilla.fenix.components.StoreProvider
|
import org.mozilla.fenix.components.StoreProvider
|
||||||
import org.mozilla.fenix.ext.navigateBlockingForAsyncNavGraph
|
import org.mozilla.fenix.ext.navigateBlockingForAsyncNavGraph
|
||||||
import org.mozilla.fenix.ext.requireComponents
|
import org.mozilla.fenix.ext.requireComponents
|
||||||
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.ext.showToolbar
|
import org.mozilla.fenix.ext.showToolbar
|
||||||
|
import org.mozilla.fenix.settings.SharedPreferenceUpdater
|
||||||
import org.mozilla.fenix.settings.SyncPreferenceView
|
import org.mozilla.fenix.settings.SyncPreferenceView
|
||||||
import org.mozilla.fenix.settings.requirePreference
|
import org.mozilla.fenix.settings.requirePreference
|
||||||
|
|
||||||
@ -46,6 +49,11 @@ class CreditCardsSettingFragment : PreferenceFragmentCompat() {
|
|||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.credit_cards_preferences, rootKey)
|
setPreferencesFromResource(R.xml.credit_cards_preferences, rootKey)
|
||||||
|
|
||||||
|
requirePreference<SwitchPreference>(R.string.pref_key_credit_cards_save_and_autofill_cards).apply {
|
||||||
|
isChecked = context.settings().shouldAutofillCreditCardDetails
|
||||||
|
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
@ -1061,4 +1061,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||||||
appContext.getPreferenceKey(R.string.pref_key_fxa_signed_in),
|
appContext.getPreferenceKey(R.string.pref_key_fxa_signed_in),
|
||||||
default = false
|
default = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Storing the user choice from the "Credit cards" settings for whether save and autofill cards
|
||||||
|
* should be enabled or not.
|
||||||
|
* If set to `true` when the user focuses on credit card fields in the webpage an Android prompt letting her
|
||||||
|
* select the card details to be automatically filled will appear.
|
||||||
|
*/
|
||||||
|
var shouldAutofillCreditCardDetails by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_credit_cards_save_and_autofill_cards),
|
||||||
|
default = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
object AndroidComponents {
|
object AndroidComponents {
|
||||||
const val VERSION = "90.0.20210525143110"
|
const val VERSION = "90.0.20210526143122"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user