fix(mobile-app): 升级弹窗禁止点击外部或返回键关闭,必须通过按钮操作
问题: 检测到新版本弹出升级对话框时,用户点击弹窗外部区域或按系统返回键 即可直接关闭弹窗,绕过升级提示,导致用户可能永远不会注意到更新。 修复: 对所有 3 个升级弹窗统一加两层防护: - barrierDismissible: false — 禁止点击弹窗外部区域关闭 - PopScope(canPop: false) — 禁止系统返回键关闭 涉及弹窗: 1. self_hosted_updater.dart - _showSelfHostedUpdateDialog(自建APK更新) 2. self_hosted_updater.dart - _showMarketUpdateDialog(应用市场引导更新) 3. update_service.dart - _checkGooglePlayUpdate(Google Play 更新) 用户必须通过弹窗内按钮操作: - 非强制更新:点击「稍后」/「暂时不更新」关闭,或点击「立即更新」开始更新 - 强制更新:只有「立即更新」按钮,无法跳过 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8f8a9230d0
commit
e02bcf418c
|
|
@ -51,9 +51,9 @@ class SelfHostedUpdater {
|
|||
void _showMarketUpdateDialog(BuildContext context, VersionInfo versionInfo) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: !versionInfo.forceUpdate,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => PopScope(
|
||||
canPop: !versionInfo.forceUpdate,
|
||||
canPop: false,
|
||||
child: AlertDialog(
|
||||
title: Text(
|
||||
versionInfo.forceUpdate ? '发现重要更新' : '发现新版本',
|
||||
|
|
@ -144,9 +144,9 @@ class SelfHostedUpdater {
|
|||
BuildContext context, VersionInfo versionInfo) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: !versionInfo.forceUpdate,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => PopScope(
|
||||
canPop: !versionInfo.forceUpdate,
|
||||
canPop: false,
|
||||
child: AlertDialog(
|
||||
title: Text(
|
||||
versionInfo.forceUpdate ? '发现重要更新' : '发现新版本',
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@ class UpdateService {
|
|||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
barrierDismissible: false,
|
||||
builder: (context) => PopScope(
|
||||
canPop: false,
|
||||
child: AlertDialog(
|
||||
title: Text(
|
||||
'发现新版本',
|
||||
style: TextStyle(
|
||||
|
|
@ -153,6 +156,7 @@ class UpdateService {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue