Skip to content

Allow Android hosts to handle navigation links - #851

Merged
kiftio merged 2 commits into
mainfrom
android-intercept-navigation-deep-links
Sep 29, 2026
Merged

kiftio merged 2 commits into
mainfrom
android-intercept-navigation-deep-links

Conversation

@kiftio

@kiftio kiftio commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Raw WebView navigations to mailto:, tel:, and custom-scheme URLs were launched by Checkout Kit directly. That bypassed the public onLinkClick / onCheckoutLinkClicked decision point, even though protocol ec.window.open_request links already use it.

Route these navigation links through the existing listener before applying the default external ACTION_VIEW behavior:

  • Open preserves the current Checkout Kit launcher behavior.
  • Handled leaves launching/routing to the host app.
  • Cancel blocks the navigation.

This makes the public link-action contract apply consistently to both protocol window-open requests and intercepted WebView navigation links. Direct intent launching is retained for the default path, so custom-scheme links do not require host <queries> declarations merely for Checkout Kit to open them.

Tests

  • Added Robolectric coverage that verifies a deep link is delegated to the listener before the default launch.
  • Added coverage that Handled and Cancel do not launch an external intent.
  • Ran:
    platforms/android/gradlew -p platforms/android \
      :lib:testDebugUnitTest \
      --tests 'com.shopify.checkoutkit.CheckoutWebViewClientTest' \
      --console=plain

Diagnostics

Adds debug logging that distinguishes an intercepted raw navigation link from the host or SDK default-handling outcome.

@kiftio
kiftio added this pull request to stack #853 September 29, 2026 08:43
@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Sep 29, 2026
@kiftio
kiftio force-pushed the android-intercept-navigation-deep-links branch from 2e5ce3e to 8c33be5 Compare September 29, 2026 08:58
@kiftio
kiftio marked this pull request as ready for review September 29, 2026 10:14
@kiftio
kiftio requested a review from a team as a code owner September 29, 2026 10:14
@github-actions

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Android release AAR 406.7 KiB 407.6 KiB +906 B
Android file breakdown
File Base Head Delta
classes.jar 433.2 KiB 434.3 KiB +1.0 KiB
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

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@bitrise

bitrise Bot commented Sep 29, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
Kotlin Install with Tophat

Checkout Kit E2E results

Status Tags Target Platform OS version tag Device
✅ launch, checkout-presentation, checkout-completion, buyer-identity, preload kotlin android latest Google Pixel 9
Android 17.0

// Returning Open keeps Checkout Kit's Custom Tab and non-web intent handling.
if (handler == WindowOpenHandler.Default) return CheckoutLinkAction.Open
if (handler == WindowOpenHandler.Default) {
recordSdkEvent("Checkout link delegated to Checkout Kit", mapOf("url" to link.url.toString()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we print the url above so probably dont need to print it here too

@kiftio
kiftio merged commit 4ed0b0c into main Sep 29, 2026
52 checks passed
@kiftio
kiftio deleted the android-intercept-navigation-deep-links branch September 29, 2026 10:46
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.

2 participants