This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 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
642642// a resume-based update still pending installation.
643643- (void )applicationWillEnterForeground
644644{
645- if (_appSuspendTimer) {
646- [_appSuspendTimer invalidate ];
647- _appSuspendTimer = nil ;
648- }
649645 // Determine how long the app was in the background and ensure
650646 // that it meets the minimum duration amount of time.
651647 int durationInBackground = 0 ;
652648 if (_lastResignedDate) {
653649 durationInBackground = [[NSDate date ] timeIntervalSinceDate: _lastResignedDate];
654650 }
655651
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+ }
658664 }
659665}
660666
You can’t perform that action at this time.
0 commit comments