Skip to content

Commit f0b334f

Browse files
committed
Merge pull request #74 from Microsoft/isFirstRunFix
Fixing isFirstRun on iOS after calling restartApp
2 parents f07fcfb + a7c358e commit f0b334f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CodePush.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
@implementation CodePush {
1010
BOOL _hasResumeListener;
11+
BOOL _isFirstRunAfterUpdate;
1112
}
1213

1314
RCT_EXPORT_MODULE()
1415

15-
static BOOL didUpdate = NO;
1616
static NSTimer *_timer;
1717
static BOOL usingTestFolder = NO;
1818

@@ -129,7 +129,7 @@ - (void)initializeUpdateAfterRestart
129129
NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
130130

131131
if (pendingUpdate) {
132-
didUpdate = true;
132+
_isFirstRunAfterUpdate = YES;
133133
int rollbackTimeout = [pendingUpdate[PendingUpdateRollbackTimeoutKey] intValue];
134134
if (0 != rollbackTimeout) {
135135
dispatch_async(dispatch_get_main_queue(), ^{
@@ -345,7 +345,7 @@ - (void)startRollbackTimer:(int)rollbackTimeout
345345
selector:@selector(loadBundle)
346346
name:UIApplicationWillEnterForegroundNotification
347347
object:[UIApplication sharedApplication]];
348-
_hasResumeListener = true;
348+
_hasResumeListener = YES;
349349
}
350350
}
351351
// Signal to JS that the update has been applied.
@@ -375,7 +375,7 @@ - (void)startRollbackTimer:(int)rollbackTimeout
375375
rejecter:(RCTPromiseRejectBlock)reject)
376376
{
377377
NSError *error;
378-
BOOL isFirstRun = didUpdate
378+
BOOL isFirstRun = _isFirstRunAfterUpdate
379379
&& nil != packageHash
380380
&& [packageHash length] > 0
381381
&& [packageHash isEqualToString:[CodePushPackage getCurrentPackageHash:&error]];

0 commit comments

Comments
 (0)