Fix Android Alipay handoff from payment webview#8755
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the payment webview flow so Android checkout pages can hand off Alipay-style app links/intents to external apps instead of remaining stuck in a webview QR flow.
Changes:
- Switches AppWebView content mode for mobile platforms and intercepts external app URL schemes.
- Adds URL utility helpers plus tests for detecting webview-external schemes.
- Adds Android method-channel support and manifest visibility entries for launching Alipay/intents.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/core/widgets/app_webview.dart |
Intercepts external app URLs from webview navigation/window creation and launches them externally. |
lib/core/utils/url_utils.dart |
Adds external-webview scheme detection and launch helpers. |
test/core/utils/url_utils_test.dart |
Adds unit tests for external scheme detection. |
android/app/src/main/kotlin/org/getlantern/lantern/handler/MethodHandler.kt |
Adds native Android handling for external URL and intent launches. |
android/app/src/main/AndroidManifest.xml |
Adds package visibility queries for Alipay schemes/package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static bool shouldOpenExternallyFromWebView(Uri uri) { | ||
| final scheme = uri.scheme.toLowerCase(); | ||
| return scheme.isNotEmpty && !_webviewHandledSchemes.contains(scheme); |
| val fallbackUrl = intent.getStringExtra("browser_fallback_url") | ||
| !fallbackUrl.isNullOrBlank() && launchExternalUrl(fallbackUrl) |
|
Took a look — clean, well-scoped fix. A few thoughts (none are blockers): What's good:
Things to consider:
LGTM. |
|
Some comments from claude incoming but overall lgtm! |
|
Thanks, @myleshorton! I fixed the fail-open scheme concern by narrowing external dispatch to a payment-specific allowlist |
Updates the payment webview to use mobile content mode on Android and launch external app schemes/intents like Alipay, so Shepherd checkout can open the Alipay app instead of getting stuck in the desktop QR flow.