fix(mobile-app): 升级弹窗显示时跳过合同/KYC后台检查

- UpdateService 添加 isShowingUpdateDialog 状态
- home_shell_page 在升级、合同签署、KYC页面均跳过后台弹窗

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-25 22:12:12 -08:00
parent 5ee12be00f
commit 148e197ea1
2 changed files with 32 additions and 16 deletions

View File

@ -19,10 +19,14 @@ class UpdateService {
late UpdateConfig _config;
SelfHostedUpdater? _selfHostedUpdater;
bool _isInitialized = false;
bool _isShowingUpdateDialog = false;
///
bool get isInitialized => _isInitialized;
///
bool get isShowingUpdateDialog => _isShowingUpdateDialog;
///
UpdateConfig get config => _config;
@ -64,13 +68,18 @@ class UpdateService {
return;
}
switch (_config.channel) {
case UpdateChannel.googlePlay:
await _checkGooglePlayUpdate(context);
break;
case UpdateChannel.selfHosted:
await _selfHostedUpdater!.checkAndPromptUpdate(context);
break;
_isShowingUpdateDialog = true;
try {
switch (_config.channel) {
case UpdateChannel.googlePlay:
await _checkGooglePlayUpdate(context);
break;
case UpdateChannel.selfHosted:
await _selfHostedUpdater!.checkAndPromptUpdate(context);
break;
}
} finally {
_isShowingUpdateDialog = false;
}
}
@ -99,7 +108,7 @@ class UpdateService {
if (!context.mounted) return;
showDialog(
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(

View File

@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
import '../../../../core/theme/app_colors.dart';
import '../../../../core/di/injection_container.dart';
import '../../../../core/services/contract_check_service.dart';
import '../../../../core/updater/update_service.dart';
import '../../../../routes/route_paths.dart';
import '../../../../bootstrap.dart';
import '../widgets/bottom_nav_bar.dart';
@ -100,8 +101,14 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
});
}
/// KYC相关页面
bool _isOnContractOrKycPage() {
/// KYC相关页面
bool _shouldSkipContractCheck() {
// 1.
if (UpdateService().isShowingUpdateDialog) {
return true;
}
// 2. /KYC页面
try {
final location = GoRouterState.of(context).uri.path;
//
@ -118,9 +125,9 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
Future<void> _performBackgroundContractCheck() async {
if (!mounted || _isShowingDialog) return;
// KYC页面
if (_isOnContractOrKycPage()) {
debugPrint('[HomeShellPage] 用户在合同/KYC页面,跳过后台检查');
// KYC页面
if (_shouldSkipContractCheck()) {
debugPrint('[HomeShellPage] 用户在合同/KYC/升级页面,跳过后台检查');
return;
}
@ -132,9 +139,9 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
if (!mounted || _isShowingDialog) return;
//
if (_isOnContractOrKycPage()) {
debugPrint('[HomeShellPage] 用户已进入合同/KYC页面,跳过弹窗');
//
if (_shouldSkipContractCheck()) {
debugPrint('[HomeShellPage] 用户已进入合同/KYC/升级页面,跳过弹窗');
return;
}