1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-18 01:36:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
tdzl2003
2016-04-05 00:48:22 +08:00
parent 2b39280f50
commit 28a11bc19e
5 changed files with 44 additions and 16 deletions

View File

@@ -124,6 +124,14 @@ public class UpdateContext {
this.clearUp();
}
public void clearRollbackMark() {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("rolledBack", false);
editor.apply();
this.clearUp();
}
public static String getBundleUrl(Context context) {
return new UpdateContext(context.getApplicationContext()).getBundleUrl();
}
@@ -133,7 +141,7 @@ public class UpdateContext {
}
public String getBundleUrl() {
return this.getBundleUrl((String)null);
return this.getBundleUrl((String) null);
}
public String getBundleUrl(String defaultAssetsUrl) {
@@ -150,7 +158,7 @@ public class UpdateContext {
editor.putBoolean("shouldRollback", true);
editor.apply();
}
return new File(rootDir, currentVersion+"/index.bundlejs").toURI().toString();
return (new File(rootDir, currentVersion+"/index.bundlejs").toString());
}
private void rollBack() {

View File

@@ -34,8 +34,12 @@ public class UpdateModule extends ReactContextBaseJavaModule{
constants.put("downloadRootDir", updateContext.getRootDir());
constants.put("packageVersion", updateContext.getPackageVersion());
constants.put("currentVersion", updateContext.getCurrentVersion());
constants.put("firstTime", updateContext.isFirstTime());
constants.put("rolledBack", updateContext.isRolledBack());
constants.put("isFirstTime", updateContext.isFirstTime());
boolean isRolledBack = updateContext.isRolledBack();
constants.put("isRolledBack", isRolledBack);
if (isRolledBack) {
updateContext.clearRollbackMark();
}
return constants;
}