-
Notifications
You must be signed in to change notification settings - Fork 658
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
Create rememberLauncher
to use Launchers in Compose
#5274
Conversation
Diffuse output:
APK
DEX
|
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.
Good catch! bringing the same approach to Financial Connections.
example/src/main/java/com/stripe/example/activity/ComposeExampleActivity.kt
Outdated
Show resolved
Hide resolved
resultCallback::onResult | ||
) | ||
|
||
return remember { |
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.
👍
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.
Should this be keyed off all of the input parameters? So that in case a different instance of any of those parameters are provided on a subsequent composition, a new instance is returned using those new values.
return remember(config, readyCallback, resultCallback) {
// ...
}
I think the same question would apply to the other rememberLauncher
methods also. (I could be wrong – still a bit of a Compose novice!)
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 also pretty new to Compose. You're partially right, I've updated the example to use the config
as a key. For the callbacks we use rememberUpdatedState
, which is also what rememberLauncherForActivityResult
uses. I added you to the API review doc, ptal and let me know if you have any suggestions.
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.
Looks good :D
e74d3aa
Summary
Create
rememberLauncher
forGooglePayLauncher
,GooglePayPaymentMethodLauncher
andPaymentLauncher
.Deprecate
PaymentLauncher.createForCompose
, which doesn't remember thePaymentLauncher
instance, creating a new one at every recomposition.Create sample Activities that use those methods on the
example
app.Doc
Motivation
Support for Compose.
Testing