fix: 修复更新跳转链接,跳转到具体版本页面

- 修改Updater.java中的confirm方法
- 从硬编码的/releases/latest改为动态跳转到/releases/tag/v{version}
- 添加latestVersion字段存储检测到的最新版本号
- 确保点击更新后跳转到正确的版本页面
- 同时修复mobile和leanback版本
This commit is contained in:
您的名字
2025-10-24 14:42:58 +08:00
parent 0fd0e245d4
commit df0333d26e
2 changed files with 8 additions and 4 deletions
@@ -32,6 +32,7 @@ public class Updater implements Download.Callback {
private AlertDialog dialog; private AlertDialog dialog;
private boolean dev; private boolean dev;
private boolean forceCheck; // 是否为手动检查 private boolean forceCheck; // 是否为手动检查
private String latestVersion; // 存储检测到的最新版本
private File getFile() { private File getFile() {
return Path.root("Download", "XMBOX-update.apk"); return Path.root("Download", "XMBOX-update.apk");
@@ -133,6 +134,7 @@ public class Updater implements Download.Callback {
String version = tagName.startsWith("v") ? tagName.substring(1) : tagName; String version = tagName.startsWith("v") ? tagName.substring(1) : tagName;
if (needUpdate(version)) { if (needUpdate(version)) {
this.latestVersion = version; // 保存最新版本号
App.post(() -> show(activity, version, body)); App.post(() -> show(activity, version, body));
} else { } else {
if (forceCheck) { if (forceCheck) {
@@ -205,9 +207,9 @@ public class Updater implements Download.Callback {
} }
private void confirm(View view) { private void confirm(View view) {
// 跳转到GitHub Releases页面而不是直接下载 // 跳转到具体版本的GitHub Releases页面
try { try {
String url = "https://github.com/Tosencen/XMBOX/releases/tag/v3.0.8"; String url = "https://github.com/Tosencen/XMBOX/releases/tag/v" + latestVersion;
Logger.d("Updater: Attempting to open URL: " + url); Logger.d("Updater: Attempting to open URL: " + url);
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
@@ -32,6 +32,7 @@ public class Updater implements Download.Callback {
private AlertDialog dialog; private AlertDialog dialog;
private boolean dev; private boolean dev;
private boolean forceCheck; // 是否为手动检查 private boolean forceCheck; // 是否为手动检查
private String latestVersion; // 存储检测到的最新版本
private File getFile() { private File getFile() {
return Path.root("Download", "XMBOX-update.apk"); return Path.root("Download", "XMBOX-update.apk");
@@ -148,6 +149,7 @@ public class Updater implements Download.Callback {
// 比较版本号 // 比较版本号
if (needUpdate(version)) { if (needUpdate(version)) {
Logger.d("Updater: Update needed, showing dialog"); Logger.d("Updater: Update needed, showing dialog");
this.latestVersion = version; // 保存最新版本号
App.post(() -> show(activity, version, body)); App.post(() -> show(activity, version, body));
} else { } else {
Logger.d("Updater: No update needed"); Logger.d("Updater: No update needed");
@@ -211,9 +213,9 @@ public class Updater implements Download.Callback {
} }
private void confirm(View view) { private void confirm(View view) {
// 跳转到GitHub Releases页面而不是直接下载 // 跳转到具体版本的GitHub Releases页面
try { try {
String url = "https://github.com/Tosencen/XMBOX/releases/tag/v3.0.8"; String url = "https://github.com/Tosencen/XMBOX/releases/tag/v" + latestVersion;
Logger.d("Updater: Attempting to open URL: " + url); Logger.d("Updater: Attempting to open URL: " + url);
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);