new: VersionRelated

This commit is contained in:
lollipopkit
2024-03-20 20:26:22 -06:00
parent d5ce11c788
commit fae3a20a9e
12 changed files with 166 additions and 95 deletions

View File

@@ -15,7 +15,9 @@ import 'package:toolbox/core/utils/platform/base.dart';
import 'package:toolbox/core/utils/sync/webdav.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/menu/server_func.dart';
import 'package:toolbox/data/model/app/version_related.dart';
import 'package:toolbox/data/model/server/custom.dart';
import 'package:toolbox/data/res/build_data.dart';
import 'package:toolbox/data/res/logger.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart';
@@ -102,6 +104,8 @@ Future<void> _initApp() async {
if (Stores.setting.icloudSync.fetch()) ICloud.sync();
}
if (Stores.setting.webdavSync.fetch()) Webdav.sync();
_doVersionRelated();
}
void _setupProviders() {
@@ -149,3 +153,13 @@ Future<void> _initDesktopWindow() async {
await windowManager.focus();
});
}
Future<void> _doVersionRelated() async {
final curVer = Stores.setting.lastVer.fetch();
const newVer = BuildData.build;
if (curVer < newVer) {
/// Call [Iterable.toList] to consume the lazy iterable.
VersionRelated.funcs.map((e) => e(newVer)).toList();
Stores.setting.lastVer.put(newVer);
}
}