Skip to content
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

Simplify PaymentSession state and lifecycle management #2165

Merged
merged 2 commits into from
Feb 11, 2020

Conversation

mshafrir-stripe
Copy link
Collaborator

@mshafrir-stripe mshafrir-stripe commented Feb 11, 2020

Summary

  • Create PaymentSessionViewModel and integrate in PaymentSession
  • Remove savedInstanceState argument from PaymentSession#init()
  • Remove PaymentSession#savePaymentSessionInstanceState()
  • Remove PaymentSession#onDestroy() - the listener instance
    is now released automatically
  • In PaymentSession#init(), immediately call the listener when
    shouldPrefetchCustomer is false
  • Move CustomerSession initialization in example app to
    Application subclass

Motivation

Simplify PaymentSession state management and API. It is
no longer necessary to pass a state Bundle and manage
lifecycle events.

Testing

Add unit tests
Manually verify with both Activity and Fragment

Summary
- Create `PaymentSessionViewModel` and integrate in `PaymentSession`
- Remove `savedInstanceState` argument from `PaymentSession#init()`
- Remove `PaymentSession#savePaymentSessionInstanceState()`
- Remove `PaymentSession#onDestroy()` - the `listener` instance
  is now released automatically
- In `PaymentSession#init()`, immediately call the `listener` when
  `shouldPrefetchCustomer` is false

- Move `CustomerSession` initialization in example app to
  `Application` subclass

Motivation
Simplify `PaymentSession` state management and API. It is
no longer necessary to pass a state `Bundle` and manage
lifecycle events.

Testing
Add unit tests
Manually verify with both `Activity` and `Fragment`
@mshafrir-stripe mshafrir-stripe merged commit b5db815 into master Feb 11, 2020
@mshafrir-stripe mshafrir-stripe deleted the refactor-payment-session branch February 11, 2020 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants