Skip to content

Commit

Permalink
Merge branch 'fix-remove-listener-ios' into cr-4-0-2
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfujita committed Feb 24, 2021
2 parents 9466978 + 8a1724f commit b8f336f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/RNGoogleCast/api/RNGCCastContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ - (void)startObserving {

// Called when this module's last listener is removed, or on dealloc.
- (void)stopObserving {
if (!hasListeners) { return; }
hasListeners = NO;
// Remove upstream listeners, stop unnecessary background tasks
[[NSNotificationCenter defaultCenter]
Expand Down
1 change: 1 addition & 0 deletions ios/RNGoogleCast/api/RNGCCastSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ - (void)startObserving {
}

- (void)stopObserving {
if (!hasListeners) { return; }
hasListeners = NO;
dispatch_async(dispatch_get_main_queue(), ^{
GCKCastSession *session = [GCKCastContext.sharedInstance.sessionManager currentCastSession];
Expand Down
1 change: 1 addition & 0 deletions ios/RNGoogleCast/api/RNGCDiscoveryManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ - (void)startObserving {

// Will be called when this module's last listener is removed, or on dealloc.
- (void)stopObserving {
if (!hasListeners) { return; }
hasListeners = NO;
dispatch_async(dispatch_get_main_queue(), ^{
[GCKCastContext.sharedInstance.discoveryManager removeListener:self];
Expand Down
1 change: 1 addition & 0 deletions ios/RNGoogleCast/api/RNGCRemoteMediaClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ - (void)startObserving {

// Will be called when this module's last listener is removed, or on dealloc.
- (void)stopObserving {
if (!hasListeners) { return; }
hasListeners = NO;
[progressTimer invalidate];
progressTimer = nil;
Expand Down

0 comments on commit b8f336f

Please sign in to comment.