mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-10 07:10:36 +08:00
Fixing isFirstRun
This commit is contained in:
@@ -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]];
|
||||
|
||||
Reference in New Issue
Block a user