diff --git a/python-for-android/dists/kolibri/src/main/java/org/kivy/android/PythonUtil.java b/python-for-android/dists/kolibri/src/main/java/org/kivy/android/PythonUtil.java index 1a9fe234..5e8341c0 100644 --- a/python-for-android/dists/kolibri/src/main/java/org/kivy/android/PythonUtil.java +++ b/python-for-android/dists/kolibri/src/main/java/org/kivy/android/PythonUtil.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.regex.Pattern; +import org.learningequality.Kolibri.BuildConfig; import org.renpy.android.AssetExtract; public class PythonUtil { @@ -123,16 +124,30 @@ protected static void recursiveDelete(File f) { f.delete(); } + public static String getPrivateVersion() { + // We read this directly from the VERSION_CODE, + // so that any upgrade of the app causes the Python + // code to be extracted again. + return Integer.toString(BuildConfig.VERSION_CODE); + } + public static void unpackAsset( Context ctx, final String resource, File target, boolean cleanup_on_version_update) { + // We only have version information for the private package + // and this should only ever be called for the "private" package + if (resource != "private") { + Log.v(TAG, "Cannot unpack " + resource + " " + target.getName()); + return; + } + Log.v(TAG, "Unpacking " + resource + " " + target.getName()); // The version of data in memory and on disk. - String dataVersion = getResourceString(ctx, resource + "_version"); + String dataVersion = getPrivateVersion(); String diskVersion = null; Log.v(TAG, "Data version is " + dataVersion); @@ -198,7 +213,7 @@ public static void unpackPyBundle( Log.v(TAG, "Unpacking " + resource + " " + target.getName()); // The version of data in memory and on disk. - String dataVersion = getResourceString(ctx, "private_version"); + String dataVersion = getPrivateVersion(); String diskVersion = null; Log.v(TAG, "Data version is " + dataVersion); diff --git a/python-for-android/dists/kolibri/src/main/res/values/strings.xml b/python-for-android/dists/kolibri/src/main/res/values/strings.xml index cff865a5..13f5e0e6 100644 --- a/python-for-android/dists/kolibri/src/main/res/values/strings.xml +++ b/python-for-android/dists/kolibri/src/main/res/values/strings.xml @@ -2,7 +2,6 @@ Kolibri :task_worker - 65f6c4c9631cdfd89ef2e450b4769e2df67a0a8f Task started… Important Tasks Running In progress