better version checking

This commit is contained in:
sirjonasxx 2021-08-19 20:14:39 +02:00
parent 1556f3f5d5
commit 2f61ac8fb6

View File

@ -17,6 +17,7 @@ import javafx.scene.layout.Region;
import javafx.scene.web.WebView; import javafx.scene.web.WebView;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.maven.artifact.versioning.ComparableVersion;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
@ -78,7 +79,7 @@ public class Main extends Application {
new URL(gitApi).openStream(), StandardCharsets.UTF_8)); new URL(gitApi).openStream(), StandardCharsets.UTF_8));
String gitv = (String)object.get("tag_name"); String gitv = (String)object.get("tag_name");
if (!gitv.equals(version)) { if (new ComparableVersion(version).compareTo(new ComparableVersion(gitv)) < 0) {
Platform.runLater(() -> { Platform.runLater(() -> {
String body = (String)object.get("body"); String body = (String)object.get("body");
boolean isForcedUpdate = body.contains("(!)"); boolean isForcedUpdate = body.contains("(!)");