支持备线切换

This commit is contained in:
2024-02-03 12:28:15 +08:00
parent 26bfa108a1
commit 72bcaf02cd
9 changed files with 184 additions and 41 deletions

View File

@ -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() {

View File

@ -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",