Skip to content

[Swift][Android][Bug]: Notify dismissal after checkout presentation closes - #932

Draft
kieran-osgood-shopify wants to merge 2 commits into
swift-accelerated-checkout-dismissalsfrom
checkout-dismissal-lifecycle
Draft

kieran-osgood-shopify wants to merge 2 commits into
swift-accelerated-checkout-dismissalsfrom
checkout-dismissal-lifecycle

Conversation

@kieran-osgood-shopify

Copy link
Copy Markdown
Contributor

What changes are you making?

Make dismissal report presentation lifecycle consistently on Swift and Android, independently of checkout outcome. This is split out of #757, which only wires accelerated checkout to the existing dismissal callback; nothing here is needed for that wiring.

For Checkout Kit-managed presentations (Swift CheckoutWebViewController, Android CheckoutBottomSheet):

Path Before After
Close button onDismiss / checkoutDidDismiss fires before the presentation starts closing Fires after the presentation has closed
Terminal failure onFail, then the presentation closes without a dismissal callback onFail, then onDismiss after the presentation has closed
Close and swipe (or buyer dismissal then failure) racing Can report dismissal more than once Reports dismissal at most once per presentation
Programmatic dismissal (dismiss(animated:), CheckoutHandle.dismiss()) No callback No callback (now documented)

Also:

  • Document on CheckoutDelegate, CheckoutListener, CheckoutPresentation, ShopifyCheckout.onDismiss, AcceleratedCheckoutButtons.onDismiss, and both platform READMEs that dismissal describes presentation lifecycle, that onFail precedes onDismiss when a failure closes checkout, and that completion does not imply dismissal.
  • Add coverage that accelerated checkout forwards failure followed by dismissal (Shop Pay), and that Apple Pay returns to idle after a Checkout Kit failure closes the fallback presentation.

The React Native layer in #749 depends on this contract: it treats close rather than fail as the end of a presentation.

How to test

GIVEN the Swift sample is configured with a storefront and has an item in the cart

WHEN the reviewer taps Check out and then taps the checkout close button

THEN the Xcode console should log [CheckoutKitSwiftDemo] Dismissed exactly once, after the sheet has finished animating closed


GIVEN the Swift sample is configured with a storefront and has an item in the cart

WHEN the reviewer taps Shop Pay and swipes the checkout sheet down

THEN the Xcode console should log [AcceleratedCheckout] Dismissed exactly once


GIVEN the Android sample is configured with a storefront and has an item in the cart

WHEN the reviewer opens checkout and closes it with the close button, the back gesture, or by dragging the sheet down

THEN the sample's Logs screen should record Checkout dismissed exactly once per presentation


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Embedded Checkout Protocol version?
  • I have bumped embeddedCheckoutProtocolAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated protocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.api if the public API changed
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

Assisted-By: devx/3f0e7f93-212d-45d8-b056-138b2da8389f
@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Oct 7, 2026
@kieran-osgood-shopify
kieran-osgood-shopify added this pull request to stack #933 October 7, 2026 11:54
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Bundle Size Budgets

Budget Size Limits Result
Android AAR package (ZIP) 408.74 KiB (+201 B) 450 KiB soft / 500 KiB hard ✅ Within budget

Bundle and package size

Web bundle sizes cover shipped runtime JavaScript. Package sizes cover the full published archive, including any source maps, declarations, and documentation it contains.

Platform Measurement Compression Base Head Delta
Android Library package (.aar) ZIP 408.5 KiB 408.7 KiB +201 B
Android package files (uncompressed)

These are uncompressed file sizes; they do not sum to the compressed package size above.

File Base Head Delta
classes.jar 435.2 KiB 435.4 KiB +187 B
res/layout/checkout_view_content.xml 2.6 KiB 2.6 KiB 0 B
res/layout/checkout_sheet_content.xml 2.0 KiB 2.0 KiB 0 B
res/values/values.xml 1.3 KiB 1.3 KiB 0 B
R.txt 1.2 KiB 1.2 KiB 0 B
AndroidManifest.xml 922 B 922 B 0 B
proguard.txt 798 B 798 B 0 B
res/drawable/close.xml 431 B 431 B 0 B
res/menu/checkout_menu.xml 354 B 354 B 0 B
META-INF/com/android/build/gradle/aar-metadata.properties 157 B 157 B 0 B
How sizes are measured

Measured from the PR base SHA and PR head SHA. Web bundle rows sum shipped .js, .mjs, and .cjs files under dist/, excluding source maps and declarations. The gzip bundle size sums files compressed individually with gzip -n -9. npm package sizes are gzip-compressed .tgz archives; Android AAR sizes are ZIP archives. Package sizes are not final app binary sizes.

The test drove the real authorization delegate, so presenting the thank-you page
called the live Storefront API (cartRemovePersonalData) with SystemClock retry
backoff, and then busy-waited on Task.yield for the idle transition. Inject a
stub storefront and MockClock, and await the idle transition through an
expectation fulfilled by a transition hook.

Assisted-By: omp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant