mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 11:24:46 +08:00
支持备线切换
This commit is contained in:
@ -113,11 +113,7 @@ class HomeUIModel extends BaseUIModel {
|
||||
.data));
|
||||
countdownFestivalListData = await Api.getFestivalCountdownList();
|
||||
notifyListeners();
|
||||
try {
|
||||
_loadRRS();
|
||||
} catch (e) {
|
||||
dPrint("_loadRRS Error:$e");
|
||||
}
|
||||
_loadRRS();
|
||||
} catch (e) {
|
||||
dPrint(e);
|
||||
}
|
||||
@ -139,6 +135,12 @@ class HomeUIModel extends BaseUIModel {
|
||||
appUpdateTimer = Timer.periodic(const Duration(minutes: 30), (timer) {
|
||||
_checkLocalizationUpdate();
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 100)).then((value) {
|
||||
if (URLConf.isUsingFallback) {
|
||||
if (!mounted) return;
|
||||
showToast(context!, "因源服务器异常(机房故障或遭受攻击),当前正在使用备用线路,可能会出现访问速度下降,敬请谅解。");
|
||||
}
|
||||
});
|
||||
super.initModel();
|
||||
}
|
||||
|
||||
@ -187,13 +189,17 @@ class HomeUIModel extends BaseUIModel {
|
||||
}
|
||||
|
||||
Future _loadRRS() async {
|
||||
final v = await RSSApi.getRssVideo();
|
||||
rssVideoItems = v;
|
||||
notifyListeners();
|
||||
final t = await RSSApi.getRssText();
|
||||
rssTextItems = t;
|
||||
notifyListeners();
|
||||
dPrint("RSS update Success !");
|
||||
try {
|
||||
final v = await RSSApi.getRssVideo();
|
||||
rssVideoItems = v;
|
||||
notifyListeners();
|
||||
final t = await RSSApi.getRssText();
|
||||
rssTextItems = t;
|
||||
notifyListeners();
|
||||
dPrint("RSS update Success !");
|
||||
} catch (e) {
|
||||
dPrint("_loadRRS Error:$e");
|
||||
}
|
||||
}
|
||||
|
||||
VoidCallback? doCheck() {
|
||||
|
@ -207,7 +207,7 @@ class WebViewModel {
|
||||
|
||||
/// https://github.com/CxJuice/Uex_Chinese_Translate
|
||||
// get versions
|
||||
const hostUrl = URLConf.webTranslateHomeUrl;
|
||||
final hostUrl = URLConf.webTranslateHomeUrl;
|
||||
dPrint("AppWebLocalizationVersionsData === ${v.toJson()}");
|
||||
|
||||
localizationResource["zh-CN"] = await _getJson("$hostUrl/zh-CN-rsi.json",
|
||||
|
45
lib/ui/splash_ui.dart
Normal file
45
lib/ui/splash_ui.dart
Normal file
@ -0,0 +1,45 @@
|
||||
import 'package:starcitizen_doctor/base/ui.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
|
||||
import 'splash_ui_model.dart';
|
||||
|
||||
class SplashUI extends BaseUI<SplashUIModel> {
|
||||
@override
|
||||
Widget? buildBody(BuildContext context, SplashUIModel model) {
|
||||
return makeDefaultPage(context, model,
|
||||
content: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset("assets/app_logo.png", width: 192, height: 192),
|
||||
const SizedBox(height: 32),
|
||||
const ProgressRing(),
|
||||
const SizedBox(height: 32),
|
||||
if (model.step == 0) const Text("正在检测可用性,这可能需要一点时间..."),
|
||||
if (model.step == 1) const Text("正在检查更新..."),
|
||||
if (model.step == 2) const Text("即将完成..."),
|
||||
],
|
||||
),
|
||||
),
|
||||
automaticallyImplyLeading: false,
|
||||
titleRow: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/app_logo_mini.png",
|
||||
width: 20,
|
||||
height: 20,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
"SC汉化盒子 V${AppConf.appVersion} ${AppConf.isMSE ? "" : " Dev"}")
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
String getUITitle(BuildContext context, SplashUIModel model) => "";
|
||||
}
|
34
lib/ui/splash_ui_model.dart
Normal file
34
lib/ui/splash_ui_model.dart
Normal file
@ -0,0 +1,34 @@
|
||||
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/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");
|
||||
await URLConf.checkHost();
|
||||
step = 1;
|
||||
notifyListeners();
|
||||
await AppConf.checkUpdate();
|
||||
step = 2;
|
||||
notifyListeners();
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context!,
|
||||
BaseUIContainer(
|
||||
uiCreate: () => IndexUI(),
|
||||
modelCreate: () => IndexUIModel()).makeRoute(context!),
|
||||
(route) => false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user