mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Some cleanup
This commit is contained in:
@@ -51,7 +51,7 @@ btnClearImageCache=Clear Image Cache
|
|||||||
btnTokenPreviewer=Token Previewer
|
btnTokenPreviewer=Token Previewer
|
||||||
btnCopyToClipboard=Copy to Clipboard
|
btnCopyToClipboard=Copy to Clipboard
|
||||||
cbpAutoUpdater=Auto updater
|
cbpAutoUpdater=Auto updater
|
||||||
nlAutoUpdater=Select what build to auto update Forge to (On Forge Start)
|
nlAutoUpdater=Select the release channel to use for updating Forge
|
||||||
cbpSelectLanguage=Language
|
cbpSelectLanguage=Language
|
||||||
nlSelectLanguage=Select Language (Excluded Game part. Still a work in progress) (RESTART REQUIRED)
|
nlSelectLanguage=Select Language (Excluded Game part. Still a work in progress) (RESTART REQUIRED)
|
||||||
cbRemoveSmall=Remove Small Creatures
|
cbRemoveSmall=Remove Small Creatures
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.download;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import forge.GuiBase;
|
import forge.GuiBase;
|
||||||
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.util.BuildInfo;
|
import forge.util.BuildInfo;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
@@ -27,7 +28,7 @@ public class AutoUpdater {
|
|||||||
private final String RELEASE_MAVEN_METADATA = "https://releases.cardforge.org/forge/forge-gui-desktop/maven-metadata.xml";
|
private final String RELEASE_MAVEN_METADATA = "https://releases.cardforge.org/forge/forge-gui-desktop/maven-metadata.xml";
|
||||||
private static final boolean VERSION_FROM_METADATA = true;
|
private static final boolean VERSION_FROM_METADATA = true;
|
||||||
|
|
||||||
public static String[] updateChannels = new String[]{ "None", "Snapshot", "Release"};
|
public static String[] updateChannels = new String[]{ "none", "snapshot", "release"};
|
||||||
|
|
||||||
private boolean isLoading;
|
private boolean isLoading;
|
||||||
private String updateChannel;
|
private String updateChannel;
|
||||||
@@ -40,8 +41,8 @@ public class AutoUpdater {
|
|||||||
public AutoUpdater(boolean loading) {
|
public AutoUpdater(boolean loading) {
|
||||||
// What do I need? Preferences? Splashscreen? UI? Skins?
|
// What do I need? Preferences? Splashscreen? UI? Skins?
|
||||||
isLoading = loading;
|
isLoading = loading;
|
||||||
final ForgePreferences.FPref updatePreference = ForgePreferences.FPref.AUTO_UPDATE;
|
updateChannel = FModel.getPreferences().getPref(ForgePreferences.FPref.AUTO_UPDATE);
|
||||||
updateChannel = "release"; //this.prefs.getPref(updatePreference);
|
buildVersion = BuildInfo.getVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean attemptToUpdate() {
|
public boolean attemptToUpdate() {
|
||||||
@@ -65,16 +66,24 @@ public class AutoUpdater {
|
|||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
// TODO This doesn't work yet, because FSkin isn't loaded at the time.
|
// TODO This doesn't work yet, because FSkin isn't loaded at the time.
|
||||||
return false;
|
return false;
|
||||||
|
} else if (updateChannel.equals("none")) {
|
||||||
|
// User clicked on check for updates withoout a valid update channel prompt
|
||||||
|
// updateChannel = newchoice or return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateChannel.equalsIgnoreCase("none")) {
|
if (buildVersion.contains("GIT")) {
|
||||||
return false;
|
return false;
|
||||||
} else if (updateChannel.equalsIgnoreCase("release")) {
|
} else if (buildVersion.contains("SNAPSHOT")) {
|
||||||
versionUrlString = RELEASE_VERSION_URL;
|
if (!updateChannel.equals("snapshot")) {
|
||||||
packageUrl = RELEASE_PACKAGE;
|
System.out.println("Snapshot build versions must use snapshot update channel to work");
|
||||||
} else {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
versionUrlString = SNAPSHOT_VERSION_URL;
|
versionUrlString = SNAPSHOT_VERSION_URL;
|
||||||
packageUrl = SNAPSHOT_PACKAGE;
|
packageUrl = SNAPSHOT_PACKAGE;
|
||||||
|
} else {
|
||||||
|
versionUrlString = RELEASE_VERSION_URL;
|
||||||
|
packageUrl = RELEASE_PACKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the internet connection
|
// Check the internet connection
|
||||||
@@ -100,14 +109,7 @@ public class AutoUpdater {
|
|||||||
try {
|
try {
|
||||||
retrieveVersion();
|
retrieveVersion();
|
||||||
|
|
||||||
buildVersion = BuildInfo.getVersionString();
|
if (StringUtils.isEmpty(version) ) {
|
||||||
|
|
||||||
if (buildVersion.contains("SNAPSHOT") && !updateChannel.equals("snapshot")) {
|
|
||||||
System.out.println("Snapshot build versions must use snapshot update channel to work");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildVersion.equalsIgnoreCase("GIT") || StringUtils.isEmpty(version) ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +121,7 @@ public class AutoUpdater {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// If version doesn't match, it's assummably newer.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,11 +162,10 @@ public class AutoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean downloadUpdate() throws URISyntaxException, IOException {
|
private boolean downloadUpdate() throws URISyntaxException, IOException {
|
||||||
// We need to preload enough of a Skins to show a dialog and a button if we're in loading
|
// Change the "auto" to be more auto.
|
||||||
// splashScreen.prepareForDialogs();
|
|
||||||
|
|
||||||
// Change the "auto" to more auto.
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
// We need to preload enough of a Skins to show a dialog and a button if we're in loading
|
||||||
|
// splashScreen.prepareForDialogs();
|
||||||
return downloadFromBrowser();
|
return downloadFromBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user