fix updater - hopefully

This commit is contained in:
Christian Schneppe 2020-05-12 20:58:13 +02:00
parent 383ae253cb
commit d0010ae4b9
No known key found for this signature in database
GPG key ID: F30B8D686B44D87E

View file

@ -17,7 +17,6 @@ import java.io.InputStreamReader;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
@ -99,19 +98,19 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
JSONObject json = new JSONObject(jsonString.toString());
if (json.getBoolean("success") && json.has("latestVersion") && json.has("appURI") && json.has("filesize")) {
String version = json.getString("latestVersion");
String[] ownVersion = BuildConfig.VERSION_NAME.split(" ");
String ownVersion = BuildConfig.VERSION_NAME;
String url = json.getString("appURI");
String filesize = json.getString("filesize");
String changelog = "";
if (json.has("changelog")) {
changelog = json.getString("changelog");
}
if (checkVersion(version, ownVersion[0]) >= 1) {
Log.d(Config.LOGTAG, "AppUpdater: Version " + Arrays.toString(ownVersion) + " should be updated to " + version);
if (checkVersion(version, ownVersion) >= 1) {
Log.d(Config.LOGTAG, "AppUpdater: Version " + ownVersion + " should be updated to " + version);
UpdateAvailable = true;
showNotification(url, changelog, version, filesize, store);
} else {
Log.d(Config.LOGTAG, "AppUpdater: Version " + Arrays.toString(ownVersion) + " is up to date");
Log.d(Config.LOGTAG, "AppUpdater: Version " + ownVersion + " is up to date");
UpdateAvailable = false;
}
}
@ -179,7 +178,7 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
String[] remoteV = null;
String[] installedV = null;
try {
installedV = installedVersion.split("-");
installedV = installedVersion.split(" ");
Log.d(Config.LOGTAG, "AppUpdater: Version installed: " + installedV[0]);
installed = installedV[0].split("\\.");
} catch (Exception e) {