Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 37278b4

Browse files
committed
Merge pull request #367 from mikedouglas/master
Fix downloadProgressCallback (RCTFrameUpdateObserver bug)
2 parents 679c725 + 287a631 commit 37278b4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

ios/CodePush/CodePush.m

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ + (void)setUsingTestConfiguration:(BOOL)shouldUseTestConfiguration
179179
@synthesize pauseCallback = _pauseCallback;
180180
@synthesize paused = _paused;
181181

182+
- (void)setPaused:(BOOL)paused
183+
{
184+
if (_paused != paused) {
185+
_paused = paused;
186+
if (_pauseCallback) {
187+
_pauseCallback();
188+
}
189+
}
190+
}
191+
182192
/*
183193
* This method is used to clear updates that are installed
184194
* under a different app version and hence don't apply anymore,
@@ -291,7 +301,7 @@ - (void)initializeUpdateAfterRestart
291301
#ifdef DEBUG
292302
[self clearDebugUpdates];
293303
#endif
294-
_paused = YES;
304+
self.paused = YES;
295305
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
296306
NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
297307
if (pendingUpdate) {
@@ -512,7 +522,7 @@ - (void)applicationWillResignActive
512522
// Set up and unpause the frame observer so that it can emit
513523
// progress events every frame if the progress is updated.
514524
_didUpdateProgress = NO;
515-
_paused = NO;
525+
self.paused = NO;
516526
}
517527

518528
[CodePushPackage
@@ -530,7 +540,7 @@ - (void)applicationWillResignActive
530540
// updates and synchronously send the last event.
531541
if (expectedContentLength == receivedContentLength) {
532542
_didUpdateProgress = NO;
533-
_paused = YES;
543+
self.paused = YES;
534544
[self dispatchDownloadProgressEvent];
535545
}
536546
}
@@ -552,7 +562,7 @@ - (void)applicationWillResignActive
552562

553563
// Stop observing frame updates if the download fails.
554564
_didUpdateProgress = NO;
555-
_paused = YES;
565+
self.paused = YES;
556566
reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
557567
}];
558568
}

0 commit comments

Comments
 (0)