-
Notifications
You must be signed in to change notification settings - Fork 662
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
Fix Link default card change ui states #10108
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
@@ -96,30 +96,34 @@ internal class WalletViewModel @Inject constructor( | |||
} | |||
} | |||
|
|||
private fun loadPaymentDetails(selectedItemId: String? = null) { | |||
private fun loadPaymentDetails() { |
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.
If the updated function is only used in the init block, should we move
_uiState.update {
it.setProcessing()
}
out of the function instead?
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.
loadPaymentDetails
is only used in the init block, so this is fine. The other calls to load use loadPaymentDetailsHelper
dispatcher.scheduler.advanceTimeBy(1.1.seconds) | ||
|
||
onWalletPaymentMethodRowLoadingIndicator().assertDoesNotExist() | ||
onWalletPayButton().assertExists() |
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.
exist or enabled?
composeTestRule.waitForIdle() | ||
|
||
onWalletPaymentMethodRowLoadingIndicator().assertIsDisplayed() |
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.
Does this introduce flakiness? Should we use waitUntilExists
instead?
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 if we have flakiness after waitForIdle
, then the screen is not behaving as expected. The loader state is changed on the main thread before kicking of any coroutines to update the card
@@ -392,17 +401,21 @@ class WalletViewModelTest { | |||
|
|||
viewModel.onSetDefaultClicked(card1) | |||
|
|||
assertThat(viewModel.uiState.value.cardBeingUpdated).isEqualTo(card1.id) | |||
|
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.
Is there a better way to simulate processing, maybe test dispatcher?
I don't know. Not a blocker for me.
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'm not sure this is the right fix -- on iOS, it looks like the payment methods are not re-ordered when the default payment method changes. Instead, just the default badge moves. I think that this is a better/smoother UI. Could we do the same thing on Android?
36040cb
to
a17477d
Compare
This what it looks like now cc @amk-stripe Screen.Recording.2025-02-11.at.4.55.46.PM.mov |
Summary
Motivation
Payment Method Update Loading State
Default Card Radio Button Flicker
Testing
Screenshots
Screen.Recording.2025-02-07.at.5.22.56.PM.mov
Changelog