stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

Move logic for saved PM selection on select saved PM screen to interactor

Open amk-stripe opened this issue 8 months ago • 1 comments

Summary

Move logic for which PM is selected on "select saved payment methods" screen to its interactor

BaseSheetViewModel now only keeps track of which PaymentOptionsItems are available, not which one is selected. CustomerSheetScreen uses the old PaymentOptionsState type, though I simplified this to keep track of the selected item instead of selected index.

Motivation

  • There's an existing bug in the selection, which this PR fixes (see before and after screen recordings)
  • We used to clear out the selection in BaseSheetViewModel in onUserBack which causes issues for vertical mode selection

Testing

  • [X] Added tests
  • [ ] Modified tests
  • [X] Manually verified

Screen recordings

Before

https://github.com/stripe/stripe-android/assets/160939932/b7705b80-bc2b-46da-afec-f4f5ad21314a

After

Uploading select saved pm -after.mp4…

Changelog

  • [Fixed]8710 Fixed issue where no payment method was selected after navigating back to the select saved payment method screen.

amk-stripe avatar Jun 27 '24 23:06 amk-stripe