Renaming restartPendingUpdate to restartApp

This commit is contained in:
Jonathan Carter
2015-11-25 17:49:47 -08:00
parent c4b96ede9f
commit 1b9e0b2315
5 changed files with 9 additions and 60 deletions

View File

@@ -376,37 +376,10 @@ public class CodePush {
}
@ReactMethod
public void restartImmediateUpdate(int rollbackTimeout) {
public void restartApp() {
loadBundle();
}
@ReactMethod
public void restartPendingUpdate() {
SharedPreferences settings = applicationContext.getSharedPreferences(CODE_PUSH_PREFERENCES, 0);
String pendingUpdateString = settings.getString(PENDING_UPDATE_KEY, null);
if (pendingUpdateString != null) {
try {
JSONObject pendingUpdateJSON = new JSONObject(pendingUpdateString);
String pendingHash = pendingUpdateJSON.getString(PENDING_UPDATE_HASH_KEY);
String currentHash = codePushPackage.getCurrentPackageHash();
if (!pendingHash.equals(currentHash)) {
throw new CodePushUnknownException("Pending hash " + pendingHash +
" and current hash " + currentHash + " are different");
}
loadBundle();
} catch (JSONException e) {
// Should not happen.
throw new CodePushUnknownException("Unable to parse pending update metadata " +
pendingUpdateString + " stored in SharedPreferences", e);
} catch (IOException e) {
// There is no current package hash.
throw new CodePushUnknownException("Should not register a pending update without a saving a current package", e);
}
}
}
@Override
public Map<String, Object> getConstants() {
final Map<String, Object> constants = new HashMap<>();