From 06fb3e8d2f2da9d1ac0a57830f14e261679f0195 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 9 Mar 2024 01:25:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=B7=E6=B1=82github=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/about/index.dart | 6 +++++- lib/utils/utils.dart | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pages/about/index.dart b/lib/pages/about/index.dart index 89aec795f..b381691ab 100644 --- a/lib/pages/about/index.dart +++ b/lib/pages/about/index.dart @@ -253,12 +253,16 @@ class AboutController extends GetxController { // 获取远程版本 Future getRemoteApp() async { var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'}); + isLoading.value = false; + if (result.data == null || result.data.isEmpty) { + SmartDialog.showToast('获取远程版本失败,请检查网络'); + return; + } data = LatestDataModel.fromJson(result.data); remoteAppInfo = data; remoteVersion.value = data.tagName!; isUpdate.value = Utils.needUpdate(currentVersion.value, remoteVersion.value); - isLoading.value = false; } // 跳转下载/本地更新 diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 62bd4d0ab..adcc7b5a1 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -243,6 +243,10 @@ class Utils { SmartDialog.dismiss(); var currentInfo = await PackageInfo.fromPlatform(); var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'}); + if (result.data == null || result.data.isEmpty) { + SmartDialog.showToast('获取远程版本失败,请检查网络'); + return false; + } LatestDataModel data = LatestDataModel.fromJson(result.data); bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!); if (isUpdate) {