Browse Source

Android: Update engine version code

pull/6/head
Hussein Kasem 4 years ago
parent
commit
4c1b935803
No known key found for this signature in database GPG Key ID: 9E61B9BC790E6B02
  1. 13
      android/src/foundation/pEp/jniadapter/AndroidHelper.java

13
android/src/foundation/pEp/jniadapter/AndroidHelper.java

@ -30,7 +30,8 @@ public class AndroidHelper {
private static File tmpDir; private static File tmpDir;
// TODO : Increment when needed. // TODO : Increment when needed.
public static int ENGINE_VERSION_CODE = 5115; // TODO : Check if this version tracking is really needed and Automatize it
public static String ENGINE_VERSION_CODE = "Release_2.1.27";
private static File shareDir; private static File shareDir;
@ -219,12 +220,12 @@ public class AndroidHelper {
} }
} }
private static int getInstalledVersion() { private static String getInstalledVersion() {
int versionCode = -1; String versionCode = "";
if (versionFile.exists()){ if (versionFile.exists()){
try { try {
Scanner scan = new Scanner(versionFile); Scanner scan = new Scanner(versionFile);
versionCode = Integer.parseInt(scan.next()); versionCode = scan.next();
scan.close(); scan.close();
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "getInstalledVersion: " + e.getMessage()); Log.e(TAG, "getInstalledVersion: " + e.getMessage());
@ -237,7 +238,7 @@ public class AndroidHelper {
try { try {
FileOutputStream fileOutputStream = new FileOutputStream(versionFile); FileOutputStream fileOutputStream = new FileOutputStream(versionFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
outputStreamWriter.write(String.valueOf(ENGINE_VERSION_CODE) + "\n"); outputStreamWriter.write(ENGINE_VERSION_CODE + "\n");
outputStreamWriter.close(); outputStreamWriter.close();
fileOutputStream.close(); fileOutputStream.close();
} catch (Exception e) { } catch (Exception e) {
@ -246,7 +247,7 @@ public class AndroidHelper {
} }
public static boolean needNewAssets() { public static boolean needNewAssets() {
return ENGINE_VERSION_CODE != getInstalledVersion(); return !getInstalledVersion().equals(ENGINE_VERSION_CODE);
} }
// TODO: replace with native impl, less prone to failure. // TODO: replace with native impl, less prone to failure.

Loading…
Cancel
Save