添加定时器,非强制更新点击稍后更新后不弹出提醒升级,30分钟后 可以再次弹出提醒

This commit is contained in:
DESKTOP-I3JPKHK\wy 2025-12-19 15:03:34 +08:00
parent 4e1a353f32
commit 7978f7c9f7
1 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -29,6 +30,8 @@ class UpgradeAuxiliaryUtils {
} }
} }
Timer? _updateLaterTimer;
static final UpgradeAuxiliaryUtils _instance = UpgradeAuxiliaryUtils._(); static final UpgradeAuxiliaryUtils _instance = UpgradeAuxiliaryUtils._();
/// UpgradeService /// UpgradeService
@ -72,6 +75,13 @@ class UpgradeAuxiliaryUtils {
}, },
onUpdateLater: () { onUpdateLater: () {
_updateLater = true; _updateLater = true;
/// 30
_updateLaterTimer?.cancel();
_updateLaterTimer = Timer(Duration(seconds: 60 * 30), () {
_updateLater = false;
});
onUpdateLater?.call(); onUpdateLater?.call();
}, },
config: config ?? (kDebugMode ? UpgradeConfig.development : UpgradeConfig.production), config: config ?? (kDebugMode ? UpgradeConfig.development : UpgradeConfig.production),