From 6d221272101c2fa6ad914d2ac751efb32b0e048a Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Mon, 13 Jul 2026 20:14:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(client/pay):=20=E4=BF=AE=20Android=20?= =?UTF-8?q?=E6=8B=89=E8=B5=B7=E6=94=B6=E9=93=B6=E5=8F=B0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?(couldn't=20open=20ali)=E2=80=94=E2=80=94AndroidManifest=20?= =?UTF-8?q?=E5=8A=A0=20(https/alipays=20=E5=8C=85=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E6=80=A7)+=20=5FopenRedirectUrl=20=E5=8E=BB=20canLaun?= =?UTF-8?q?chUrl=20=E8=AF=AF=E5=88=A4=E6=94=B9=E5=A4=96=E9=83=A8=E2=86=92a?= =?UTF-8?q?pp=E5=86=85=E6=B5=8F=E8=A7=88=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/app/src/main/AndroidManifest.xml | 22 +++++++++++++++++++ client/lib/screens/payment_page.dart | 22 +++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/client/android/app/src/main/AndroidManifest.xml b/client/android/app/src/main/AndroidManifest.xml index 2a81d58..ba725ae 100644 --- a/client/android/app/src/main/AndroidManifest.xml +++ b/client/android/app/src/main/AndroidManifest.xml @@ -29,6 +29,28 @@ --> + + + + + + + + + + + + + + + + + { // 而非静默无反应。 Future _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(真相源既有样式,非新造)。