mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
add mobile updater, update gdx natives
This commit is contained in:
@@ -30,7 +30,7 @@ public enum CSubmenuDownloaders implements ICDoc {
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
private final UiCommand cmdLicensing = VSubmenuDownloaders.SINGLETON_INSTANCE::showLicensing;
|
||||
private final UiCommand cmdCheckForUpdates = () -> new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(null, null, null)));
|
||||
private final UiCommand cmdCheckForUpdates = () -> new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(null, null)));
|
||||
|
||||
private final UiCommand cmdPicDownload = () -> new GuiDownloader(new GuiDownloadPicturesLQ()).show();
|
||||
private final UiCommand cmdPicDownloadHQ = () -> new GuiDownloader(new GuiDownloadPicturesHQ()).show();
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package forge.util;
|
||||
|
||||
import com.apptasticsoftware.rssreader.Item;
|
||||
import com.apptasticsoftware.rssreader.RssReader;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class RSSReader {
|
||||
public static String getCommitLog(Date buildDateOriginal, SimpleDateFormat dateFormat, Date max) {
|
||||
String message = "";
|
||||
SimpleDateFormat simpleDate = dateFormat;
|
||||
if (simpleDate == null)
|
||||
simpleDate = new SimpleDateFormat("E, MMM dd, yyyy - hh:mm:ss a");
|
||||
try {
|
||||
RssReader reader = new RssReader();
|
||||
URL url = new URL("https://github.com/Card-Forge/forge/commits/master.atom");
|
||||
InputStream inputStream = url.openStream();
|
||||
List<Item> items = reader.read(inputStream).toList();
|
||||
StringBuilder logs = new StringBuilder();
|
||||
int c = 0;
|
||||
for (Item i : items) {
|
||||
if (i.getTitle().isEmpty())
|
||||
continue;
|
||||
String title = TextUtil.stripNonValidXMLCharacters(i.getTitle().get());
|
||||
if (title.contains("Merge"))
|
||||
continue;
|
||||
ZonedDateTime zonedDateTime = i.getPubDateZonedDateTime().isPresent() ? i.getPubDateZonedDateTime().get() : null;
|
||||
if (zonedDateTime == null)
|
||||
continue;
|
||||
Date feedDate = Date.from(zonedDateTime.toInstant());
|
||||
if (buildDateOriginal != null && feedDate.before(buildDateOriginal))
|
||||
continue;
|
||||
if (max != null && feedDate.after(max))
|
||||
continue;
|
||||
logs.append(simpleDate.format(feedDate)).append(" | ").append(StringEscapeUtils.unescapeXml(title).replace("\n", "").replace(" ", "")).append("\n\n");
|
||||
if (c >= 15)
|
||||
break;
|
||||
c++;
|
||||
}
|
||||
if (logs.length() > 0)
|
||||
message += ("\n\nLatest Changes:\n\n" + logs);
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -420,7 +420,7 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
||||
}
|
||||
}
|
||||
public class UpdaterButton extends TitleBarButton {
|
||||
final int MARQUEE_SPEED_DIV = 25;
|
||||
final int MARQUEE_SPEED_DIV = 15;
|
||||
final int REPAINT_WITHIN_MS = 25;
|
||||
final String displayText = FControl.instance.compareVersion(BuildInfo.getVersionString());
|
||||
private UpdaterButton() {
|
||||
@@ -431,7 +431,7 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
try {
|
||||
new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(null, null, null)));
|
||||
new AutoUpdater(false).attemptToUpdate(CompletableFuture.supplyAsync(() -> RSSReader.getCommitLog(null, null)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user