app/lib/ui/splash_ui_model.dart

40 lines
1.0 KiB
Dart
Raw Normal View History

2024-02-03 12:28:15 +08:00
import 'package:starcitizen_doctor/api/analytics.dart';
import 'package:starcitizen_doctor/base/ui_model.dart';
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
2024-02-23 00:07:48 +08:00
import 'package:starcitizen_doctor/common/io/aria2c.dart';
2024-02-03 12:28:15 +08:00
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");
2024-02-15 21:24:39 +08:00
try {
await URLConf.checkHost();
} catch (e) {
dPrint("checkHost Error:$e");
}
2024-02-03 12:28:15 +08:00
step = 1;
notifyListeners();
await AppConf.checkUpdate();
step = 2;
notifyListeners();
2024-02-24 17:41:44 +08:00
await Aria2cManager.checkLazyLoad();
2024-02-03 12:28:15 +08:00
Navigator.pushAndRemoveUntil(
context!,
BaseUIContainer(
uiCreate: () => IndexUI(),
modelCreate: () => IndexUIModel()).makeRoute(context!),
(route) => false);
}
}