Android implementation

This commit is contained in:
Jonathan Carter
2015-12-27 00:25:28 -08:00
parent fda496313c
commit 57390ef020
2 changed files with 8 additions and 4 deletions

View File

@@ -241,7 +241,7 @@ public class CodePush {
try {
boolean updateIsPending = pendingUpdate != null &&
pendingUpdate.getBoolean(PENDING_UPDATE_IS_LOADING_KEY) == false &&
pendingUpdate.getString(PENDING_UPDATE_HASH_KEY).equals(packageHash);
(packageHash == null || pendingUpdate.getString(PENDING_UPDATE_HASH_KEY).equals(packageHash));
return updateIsPending;
}
catch (JSONException e) {
@@ -483,8 +483,12 @@ public class CodePush {
}
@ReactMethod
public void restartApp() {
loadBundle();
public void restartApp(boolean onlyIfUpdateIsPending) {
// If this is an unconditional restart request, or there
// is current pending update, then reload the app.
if (!onlyIfUpdateIsPending || CodePush.this.isPendingUpdate(null)) {
loadBundle();
}
}
@ReactMethod