app/lib/ui/splash_ui_model.dart
2024-02-24 17:41:44 +08:00

40 lines
1.0 KiB
Dart

import 'package:starcitizen_doctor/api/analytics.dart';
import 'package:starcitizen_doctor/base/ui_model.dart';
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
import 'package:starcitizen_doctor/common/io/aria2c.dart';
import 'package:starcitizen_doctor/ui/index_ui.dart';
import 'package:starcitizen_doctor/ui/index_ui_model.dart';
import '../common/conf/app_conf.dart';
class SplashUIModel extends BaseUIModel {
int step = 0;
@override
void initModel() {
_initApp();
super.initModel();
}
Future<void> _initApp() async {
AnalyticsApi.touch("launch");
try {
await URLConf.checkHost();
} catch (e) {
dPrint("checkHost Error:$e");
}
step = 1;
notifyListeners();
await AppConf.checkUpdate();
step = 2;
notifyListeners();
await Aria2cManager.checkLazyLoad();
Navigator.pushAndRemoveUntil(
context!,
BaseUIContainer(
uiCreate: () => IndexUI(),
modelCreate: () => IndexUIModel()).makeRoute(context!),
(route) => false);
}
}