Skip to content

Commit

Permalink
Remove private version string in favour of version code.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jan 10, 2024
1 parent 3e34e46 commit f536093
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<resources>
<string name="app_name">Kolibri</string>
<string name="task_worker_process" translatable="false">:task_worker</string>
<string name="private_version">65f6c4c9631cdfd89ef2e450b4769e2df67a0a8f</string>
<string name="notification_channel_ticker">Task started…</string>
<string name="notification_service_channel_title">Important Tasks Running</string>
<string name="notification_service_channel_content">In progress</string>
Expand Down

0 comments on commit f536093

Please sign in to comment.