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

bugfix: 从安装包首次更新后即回滚处理有问题

This commit is contained in:
tdzl2003
2016-04-05 23:11:28 +08:00
parent f9dd87f6c0
commit bce345b65d

View File

@@ -174,16 +174,20 @@ public class UpdateContext {
currentVersion = this.rollBack();
}
}
if (currentVersion == null) {
return defaultAssetsUrl;
}
return (new File(rootDir, currentVersion+"/index.bundlejs").toString());
}
private String rollBack() {
String lastVersion = sp.getString("lastVersion", null);
if (lastVersion == null) {
throw new Error("This should never happen");
}
SharedPreferences.Editor editor = sp.edit();
editor.putString("currentVersion", lastVersion);
if (lastVersion == null) {
editor.remove("currentVersion");
} else {
editor.putString("currentVersion", lastVersion);
}
editor.putBoolean("firstTimeOk", true);
editor.putBoolean("firstTime", false);
editor.putBoolean("rolledBack", true);