fix(client/pay): 修 Android 拉起收银台失败(couldn't open ali)——AndroidManifest 加 <queries>(https/alipays 包可见性)+ _openRedirectUrl 去 canLaunchUrl 误判改外部→app内浏览兜底
ci-pangolin / Lint — shellcheck (pull_request) Successful in 13s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 28s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 21s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 38s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 22s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Failing after 12s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 10s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 4m42s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 19s
ci-pangolin / OpenAPI Sync Check (pull_request) Failing after 14m51s

This commit is contained in:
wangjia
2026-07-13 20:14:03 +08:00
parent 68608d6471
commit 6d22127210
2 changed files with 33 additions and 11 deletions
@@ -29,6 +29,28 @@
-->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<!--
Android 11+ (API 30) 包可见性:不声明 <queries> 时 canLaunchUrl / launchUrl
对 https 及自定义 scheme 会被系统判为「无可处理应用」→ 支付页「打开支付宝」拉起
收银台 https 页被误判无法打开(报 openAlipayFailed)。声明浏览器(http/https VIEW)
+ 支付宝 scheme/包,让拉起收银台页(→ 扫码/打开支付宝)正常工作。
-->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="alipays" />
</intent>
<package android:name="com.eg.android.AlipayGphone" />
</queries>
<application
android:label="穿山甲"
android:name="${applicationName}"
+11 -11
View File
@@ -81,21 +81,21 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
// 而非静默无反应。
Future<void> _openRedirectUrl(BuildContext context, String url) async {
final uri = Uri.tryParse(url);
if (uri == null) {
if (uri == null || url.isEmpty) {
if (context.mounted) showPangolinToast(context, t.openAlipayFailed);
return;
}
// payload.url 是收银台 https 页(二维码 + 打开支付宝 + 轮询),不是裸 alipays 深链。
// 不用 canLaunchUrl 预判:Android 11+ 包可见性下它对 https 常误判 false(即本次
// 「couldn't open ali」根因)。直接试:外部浏览器/支付宝 → 失败退 app 内浏览视图
// (Custom Tab/WebView,收银台页在 app 内显示,没装支付宝也能扫码/走 H5)。
try {
final can = await canLaunchUrl(uri);
if (!can) {
if (context.mounted) showPangolinToast(context, t.openAlipayFailed);
return;
}
final ok = await launchUrl(uri, mode: LaunchMode.externalApplication);
if (!ok && context.mounted) showPangolinToast(context, t.openAlipayFailed);
} catch (_) {
if (context.mounted) showPangolinToast(context, t.openAlipayFailed);
}
if (await launchUrl(uri, mode: LaunchMode.externalApplication)) return;
} catch (_) {}
try {
if (await launchUrl(uri, mode: LaunchMode.inAppBrowserView)) return;
} catch (_) {}
if (context.mounted) showPangolinToast(context, t.openAlipayFailed);
}
// 卡片配方 = account_page.dart::_Card(真相源既有样式,非新造)。