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(真相源既有样式,非新造)。