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

@@ -394,35 +394,13 @@ RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve
}
/*
* This method isn't publicly exposed via the "react-native-code-push"
* module, and is only used internally to support immediately installed updates.
* This method is the native side of the CodePush.restartApp() method.
*/
RCT_EXPORT_METHOD(restartImmediateUpdate:(int)rollbackTimeout)
RCT_EXPORT_METHOD(restartApp
{
[self loadBundle];
}
/*
* This method is the native side of the CodePush.restartPendingUpdate() method.
*/
RCT_EXPORT_METHOD(restartPendingUpdate)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
if (pendingUpdate) {
NSError *error;
NSString *pendingHash = pendingUpdate[PendingUpdateHashKey];
NSString *currentHash = [CodePushPackage getCurrentPackageHash:&error];
NSAssert([pendingHash isEqualToString:currentHash], @"There is a pending update but it's hash doesn't match that of the current package.");
[self loadBundle];
}
});
}
RCT_EXPORT_METHOD(setUsingTestFolder:(BOOL)shouldUseTestFolder)
{
usingTestFolder = shouldUseTestFolder;