✨ 完善版本检查反馈:添加'已是最新版'提示
- 修复点击版本号检查更新时无反馈的问题 - 添加'已是最新版本'的友好提示 - 优化用户体验,确保每次点击都有明确反馈 - 支持移动端和TV端
This commit is contained in:
@@ -14,6 +14,7 @@ import com.fongmi.android.tv.utils.Notify;
|
|||||||
import com.fongmi.android.tv.utils.ResUtil;
|
import com.fongmi.android.tv.utils.ResUtil;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Github;
|
import com.github.catvod.utils.Github;
|
||||||
|
import com.github.catvod.utils.Logger;
|
||||||
import com.github.catvod.utils.Path;
|
import com.github.catvod.utils.Path;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
@@ -97,7 +98,13 @@ public class Updater implements Download.Callback {
|
|||||||
String name = object.optString("name");
|
String name = object.optString("name");
|
||||||
String desc = object.optString("desc");
|
String desc = object.optString("desc");
|
||||||
int code = object.optInt("code");
|
int code = object.optInt("code");
|
||||||
if (need(code, name)) App.post(() -> show(activity, name, desc));
|
if (need(code, name)) {
|
||||||
|
App.post(() -> show(activity, name, desc));
|
||||||
|
} else {
|
||||||
|
// 不需要更新,提示已是最新版
|
||||||
|
App.post(() -> Notify.show("已是最新版本 " + name));
|
||||||
|
Logger.d("Already latest version: " + name);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// 添加用户友好的错误提示
|
// 添加用户友好的错误提示
|
||||||
|
|||||||
@@ -154,8 +154,14 @@ public class Updater implements Download.Callback {
|
|||||||
if (downloadUrl != null && need(tagName)) {
|
if (downloadUrl != null && need(tagName)) {
|
||||||
download = Download.create(downloadUrl, getFile(), this);
|
download = Download.create(downloadUrl, getFile(), this);
|
||||||
App.post(() -> show(activity, tagName, body));
|
App.post(() -> show(activity, tagName, body));
|
||||||
|
} else if (downloadUrl != null) {
|
||||||
|
// 找到APK但不需要更新,提示已是最新版
|
||||||
|
App.post(() -> Notify.show("已是最新版本 " + tagName));
|
||||||
|
Logger.d("Already latest version: " + tagName);
|
||||||
} else {
|
} else {
|
||||||
Logger.d("No update needed or APK not found");
|
// 未找到对应的APK文件
|
||||||
|
App.post(() -> Notify.show("检查更新完成,未找到适合此设备的安装包"));
|
||||||
|
Logger.d("APK not found for this device");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.e("Update check failed", e);
|
Logger.e("Update check failed", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user