-
Notifications
You must be signed in to change notification settings - Fork 471
For #10331 - Allow dynamically toggling CC autofill #10332
Conversation
@@ -131,6 +131,7 @@ class PromptFeature private constructor( | |||
private val shareDelegate: ShareDelegate, | |||
override val loginValidationDelegate: LoginValidationDelegate? = null, | |||
private val isSaveLoginEnabled: () -> Boolean = { false }, | |||
private val isCCAutofillEnabled: () -> Boolean = { false }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should prefer saying CreditCard instead of CC. Can you also add the @Property?
private val isCCAutofillEnabled: () -> Boolean = { false }, | |
private val isCreditCardAutofillEnabled: () -> Boolean = { false }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thank you!
@@ -19,7 +20,8 @@ import mozilla.components.concept.storage.CreditCardsAddressesStorageDelegate | |||
*/ | |||
class GeckoCreditCardsAddressesStorageDelegate( | |||
private val storage: Lazy<CreditCardsAddressesStorage>, | |||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO) | |||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO), | |||
private val isCCAutofillEnabled: () -> Boolean = { false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not quite sure if we want to add this parameter to GeckoCreditCardsAddressesStorageDelegate
. I think it should be enough if we just intercept the request and block it from showing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can disable this in PromptFeature
. And this condition is indeed checked there also.
Here it's used to skip querying storage for data that won't be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also the same approach initially used for toggling logins autofill before there was a GeckoRuntimeSettings
available for it.
I can remove this if you want but I feel like there's a real benefit in having this check also here.
c5eee0c
to
f4b0d7f
Compare
delegate.onCreditCardsFetch() | ||
val storage: AutofillCreditCardsAddressesStorage = mock() | ||
val storedCards = listOf<CreditCard>(mock()) | ||
Mockito.doReturn(storedCards).`when`(storage).getAllCreditCards() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prehaps import doReturn
Mockito.doReturn(storedCards).`when`(storage).getAllCreditCards() | |
doReturn(storedCards).`when`(storage).getAllCreditCards() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Thank you!
f4b0d7f
to
92023b7
Compare
Fixes #10331
Result in Fenix:
TogglingCCAutofill.mp4
Pull Request checklist
After merge