Skip to content

Commit

Permalink
Merge pull request #74 from Microsoft/isFirstRunFix
Browse files Browse the repository at this point in the history
Fixing isFirstRun on iOS after calling restartApp
  • Loading branch information
lostintangent committed Nov 26, 2015
2 parents f07fcfb + a7c358e commit f0b334f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CodePush.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

@implementation CodePush {
BOOL _hasResumeListener;
BOOL _isFirstRunAfterUpdate;
}

RCT_EXPORT_MODULE()

static BOOL didUpdate = NO;
static NSTimer *_timer;
static BOOL usingTestFolder = NO;

Expand Down Expand Up @@ -129,7 +129,7 @@ - (void)initializeUpdateAfterRestart
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(), ^{
Expand Down Expand Up @@ -345,7 +345,7 @@ - (void)startRollbackTimer:(int)rollbackTimeout
selector:@selector(loadBundle)
name:UIApplicationWillEnterForegroundNotification
object:[UIApplication sharedApplication]];
_hasResumeListener = true;
_hasResumeListener = YES;
}
}
// Signal to JS that the update has been applied.
Expand Down Expand Up @@ -375,7 +375,7 @@ - (void)startRollbackTimer:(int)rollbackTimeout
rejecter:(RCTPromiseRejectBlock)reject)
{
NSError *error;
BOOL isFirstRun = didUpdate
BOOL isFirstRun = _isFirstRunAfterUpdate
&& nil != packageHash
&& [packageHash length] > 0
&& [packageHash isEqualToString:[CodePushPackage getCurrentPackageHash:&error]];
Expand Down

0 comments on commit f0b334f

Please sign in to comment.