File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -642,19 +642,25 @@ - (void)savePendingUpdate:(NSString *)packageHash
642
642
// a resume-based update still pending installation.
643
643
- (void )applicationWillEnterForeground
644
644
{
645
- if (_appSuspendTimer) {
646
- [_appSuspendTimer invalidate ];
647
- _appSuspendTimer = nil ;
648
- }
649
645
// Determine how long the app was in the background and ensure
650
646
// that it meets the minimum duration amount of time.
651
647
int durationInBackground = 0 ;
652
648
if (_lastResignedDate) {
653
649
durationInBackground = [[NSDate date ] timeIntervalSinceDate: _lastResignedDate];
654
650
}
655
651
656
- if (durationInBackground >= _minimumBackgroundDuration) {
657
- [self loadBundle ];
652
+ if (_installMode == CodePushInstallModeOnNextSuspend) {
653
+ // We shouldn't use loadBundle in this case, because _appSuspendTimer will call loadBundleOnTick.
654
+ // We should cancel timer for _appSuspendTimer because otherwise, we would call loadBundle two times.
655
+ if (durationInBackground < _minimumBackgroundDuration) {
656
+ [_appSuspendTimer invalidate ];
657
+ _appSuspendTimer = nil ;
658
+ }
659
+ } else {
660
+ // For resume install mode.
661
+ if (durationInBackground >= _minimumBackgroundDuration) {
662
+ [self loadBundle ];
663
+ }
658
664
}
659
665
}
660
666
You can’t perform that action at this time.
0 commit comments