-
Notifications
You must be signed in to change notification settings - Fork 675
Move Address Element
autocomplete state & navigation handling into separate element.
#11035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
c7f966a
to
b06b6d5
Compare
4522dd3
to
baa004b
Compare
.filter { | ||
it.value.isComplete | ||
} | ||
} |
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.
Deleted FormController
and replaced with a simple controller/holder for Address Element
functionality. We can probably move this into InputAddressViewModel
but also can be kept and tested here.
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 won't be re-used for MPE.
fun interface Factory { | ||
fun create(): AutocompleteAddressInteractor | ||
} | ||
} |
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.
The primary interactor for managing autocomplete state. This will be used to navigate to autocomplete and respond to its result. MPE will have a separate implementation.
scope = interactor.interactorScope, | ||
started = SharingStarted.Lazily, | ||
initialValue = createAddressElement(addressType.value, state.value), | ||
) |
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.
Highlighting this comment as to why I'm choosing to use stateIn
for this element.
modifier = modifier, | ||
) | ||
} | ||
} |
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.
Maybe this is better secluded inside of the AddressElement
component? My worry at the moment with secluding it in AddressElement
is the complexity that will be added to it given how complex AddressElement
already is.
stripe-ui-core/src/main/java/com/stripe/android/uicore/elements/AutocompleteAddressElement.kt
Show resolved
Hide resolved
...pe-ui-core/src/main/java/com/stripe/android/uicore/elements/AutocompleteAddressInteractor.kt
Show resolved
Hide resolved
...pe-ui-core/src/main/java/com/stripe/android/uicore/elements/AutocompleteAddressController.kt
Show resolved
Hide resolved
...tsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressFormController.kt
Show resolved
Hide resolved
...tsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressFormController.kt
Show resolved
Hide resolved
getSectionFieldTextControllerWithLabel(addressFormController, UiCoreR.string.stripe_email) | ||
|
||
nameElement?.onValueChange("joe") | ||
assertThat( |
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.
Let's test this with Turbine?
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.
Yup! This tests were from the original FormController
. These all need to be modified.
Summary
Move
Address Element
autocomplete state & navigation handling into separate element.Motivation
Allows for autocomplete logic to be shared in MPE.
Testing