添加定时器,非强制更新点击稍后更新后不弹出提醒升级,30分钟后 可以再次弹出提醒
This commit is contained in:
parent
4e1a353f32
commit
7978f7c9f7
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
|
@ -29,6 +30,8 @@ class UpgradeAuxiliaryUtils {
|
|||
}
|
||||
}
|
||||
|
||||
Timer? _updateLaterTimer;
|
||||
|
||||
static final UpgradeAuxiliaryUtils _instance = UpgradeAuxiliaryUtils._();
|
||||
|
||||
/// 获取 UpgradeService 单例
|
||||
|
|
@ -72,6 +75,13 @@ class UpgradeAuxiliaryUtils {
|
|||
},
|
||||
onUpdateLater: () {
|
||||
_updateLater = true;
|
||||
|
||||
/// 30分钟 后重置,可以重新弹出
|
||||
_updateLaterTimer?.cancel();
|
||||
_updateLaterTimer = Timer(Duration(seconds: 60 * 30), () {
|
||||
_updateLater = false;
|
||||
});
|
||||
|
||||
onUpdateLater?.call();
|
||||
},
|
||||
config: config ?? (kDebugMode ? UpgradeConfig.development : UpgradeConfig.production),
|
||||
|
|
|
|||
Loading…
Reference in New Issue