update date check, fix version String

This commit is contained in:
Anthony Calosa
2024-11-01 08:17:11 +08:00
parent 43912cbbb2
commit ce1d4b6a58
2 changed files with 5 additions and 8 deletions

View File

@@ -29,9 +29,9 @@ public class GitLogs {
if (entry.updated == null)
continue;
Date feedDate = atomDate.parse(entry.updated);
if (buildDateOriginal != null && feedDate.before(buildDateOriginal))
if (buildDateOriginal != null && feedDate.toInstant().isBefore(buildDateOriginal.toInstant()))
continue;
if (maxDate != null && feedDate.after(maxDate))
if (maxDate != null && feedDate.toInstant().isAfter(maxDate.toInstant()))
continue;
logs.append(simpleDate.format(feedDate)).append(" | ").append(StringEscapeUtils.unescapeXml(title).replace("\n", "").replace(" ", "")).append("\n\n");
if (c >= 15)

View File

@@ -72,11 +72,7 @@ public class AssetsDownloader {
final String releaseTag = Forge.getDeviceAdapter().getReleaseTag(GITHUB_RELEASES_ATOM);
try {
URL versionUrl = new URL(versionText);
String version = "";
if (GuiBase.isAndroid())
version = FileUtil.readFileToString(versionUrl);
else //instead of parsing xml from earlier releases, get the latest github release tag
version = releaseTag.replace("forge-", "");
String version = isSnapshots ? FileUtil.readFileToString(versionUrl) : releaseTag.replace("forge-", "");
String filename = "";
String installerURL = "";
if (GuiBase.isAndroid()) {
@@ -121,7 +117,8 @@ public class AssetsDownloader {
if (!Forge.getDeviceAdapter().isConnectedToWifi()) {
message += " If so, you may want to connect to wifi first. The download is around " + (GuiBase.isAndroid() ? apkSize : packageSize) + ".";
}
message += Forge.getDeviceAdapter().getLatestChanges(GITHUB_COMMITS_ATOM, buildTimeStamp, snapsTimestamp);
if (isSnapshots) // this is for snaps initial info
message += Forge.getDeviceAdapter().getLatestChanges(GITHUB_COMMITS_ATOM, buildTimeStamp, snapsTimestamp);
//failed to grab latest github tag
if (!isSnapshots && releaseTag.isEmpty()) {
if (!GuiBase.isAndroid())