diff --git a/CodePush.m b/CodePush.m index 5c1fc1a..5e71dfe 100644 --- a/CodePush.m +++ b/CodePush.m @@ -8,11 +8,11 @@ @implementation CodePush { BOOL _hasResumeListener; + BOOL _isFirstRunAfterUpdate; } RCT_EXPORT_MODULE() -static BOOL didUpdate = NO; static NSTimer *_timer; static BOOL usingTestFolder = NO; @@ -129,7 +129,7 @@ static NSString *const PendingUpdateRollbackTimeoutKey = @"rollbackTimeout"; NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey]; if (pendingUpdate) { - didUpdate = true; + _isFirstRunAfterUpdate = YES; int rollbackTimeout = [pendingUpdate[PendingUpdateRollbackTimeoutKey] intValue]; if (0 != rollbackTimeout) { dispatch_async(dispatch_get_main_queue(), ^{ @@ -345,7 +345,7 @@ RCT_EXPORT_METHOD(installUpdate:(NSDictionary*)updatePackage selector:@selector(loadBundle) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]]; - _hasResumeListener = true; + _hasResumeListener = YES; } } // Signal to JS that the update has been applied. @@ -375,7 +375,7 @@ RCT_EXPORT_METHOD(isFirstRun:(NSString *)packageHash rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; - BOOL isFirstRun = didUpdate + BOOL isFirstRun = _isFirstRunAfterUpdate && nil != packageHash && [packageHash length] > 0 && [packageHash isEqualToString:[CodePushPackage getCurrentPackageHash:&error]];