1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 13:11:39 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Check android bundle file before reload

This commit is contained in:
sunnylqm
2020-01-13 21:58:33 +08:00
parent fa754ef8a2
commit 8d06235ea3

View File

@@ -4,6 +4,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@@ -182,10 +184,18 @@ public class UpdateContext {
currentVersion = this.rollBack();
}
}
if (currentVersion == null) {
return defaultAssetsUrl;
while (currentVersion != null) {
File bundleFile = new File(rootDir, currentVersion+"/index.bundlejs");
if (!bundleFile.exists()) {
Log.e("getBundleUrl", "Bundle version " + currentVersion + " not found.");
currentVersion = this.rollBack();
continue;
}
return bundleFile.toString();
}
return (new File(rootDir, currentVersion+"/index.bundlejs").toString());
return defaultAssetsUrl;
}
private String rollBack() {