Annotate Checkout Element presentation methods with MainThread - #14351
Annotate Checkout Element presentation methods with MainThread#14351cttsai-stripe wants to merge 1 commit into
Conversation
Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com>
| @@ -56,18 +58,23 @@ class ShippingAddressElement @Inject internal constructor( | |||
| } | |||
|
|
|||
| shippingAddressElementStateHolder.isPresenting = true | |||
There was a problem hiding this comment.
SavedStateHandle.set/get is @MainThread
| */ | ||
| @MainThread | ||
| fun present() { | ||
| contentHelper.presentPaymentOptions() |
There was a problem hiding this comment.
We could mark out internal implementations as well as a reminder for ourselves.
jaynewstrom-stripe
left a comment
There was a problem hiding this comment.
This feels like we're leaking implementation details. Can we coroutineScope + Dispatchers.Main.immediate these instead?
IIUC, if we do that and |
Summary
Annotate Checkout Element presentation methods with
@MainThread.Motivation
PaymentElement.present()andShippingAddressElement.present()synchronously access UI, lifecycle, Activity Result, and state-holder behavior. This makes the existing caller requirement explicit for static analysis and IDE tooling with AndroidX@MainThread, without changing runtime behavior.Testing
Existing focused
PaymentElementTestandShippingAddressElementTestpassed.:paymentsheet:apiDump,:paymentsheet:apiCheck,:paymentsheet:detekt, andgit diff --checkpassed. The push hook also reran:paymentsheet:apiCheckand:paymentsheet:detektsuccessfully.Screenshots
Not applicable. This is an annotation-only API contract change with no visual or runtime UI change.
Changelog
No changelog entry. This preview API annotation documents an existing caller contract and does not change runtime behavior.
Committed and created by Codex.