diff --git a/CodePush.m b/CodePush.m index d08d560..5960d8d 100644 --- a/CodePush.m +++ b/CodePush.m @@ -109,6 +109,7 @@ static NSString *const PackageIsPendingKey = @"isPending"; { [CodePushPackage clearUpdates]; [self removePendingUpdate]; + [self removeFailedUpdates]; } @@ -270,6 +271,17 @@ static NSString *const PackageIsPendingKey = @"isPending"; [preferences synchronize]; } +/* + * This method is used to clear away failed updates in the event that + * a new app store binary is installed. + */ ++ (void)removeFailedUpdates +{ + NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; + [preferences removeObjectForKey:FailedUpdatesKey]; + [preferences synchronize]; +} + /* * This method is used to register the fact that a pending * update succeeded and therefore can be removed. diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java index b41a27f..5ff9190 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java @@ -238,6 +238,11 @@ public class CodePush { } } + private void removeFailedUpdates() { + SharedPreferences settings = applicationContext.getSharedPreferences(CODE_PUSH_PREFERENCES, 0); + settings.edit().remove(FAILED_UPDATES_KEY).commit(); + } + private void removePendingUpdate() { SharedPreferences settings = applicationContext.getSharedPreferences(CODE_PUSH_PREFERENCES, 0); settings.edit().remove(PENDING_UPDATE_KEY).commit(); @@ -310,6 +315,7 @@ public class CodePush { public void clearUpdates() { codePushPackage.clearUpdates(); removePendingUpdate(); + removeFailedUpdates(); } private class CodePushNativeModule extends ReactContextBaseJavaModule {