Refresh app and host state when returning from streaming via error

This commit is contained in:
Cameron Gutman
2018-06-01 00:47:44 -07:00
parent 04b2fccaef
commit 653a789110
@@ -656,16 +656,23 @@ static NSMutableSet* hostList;
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
-(void)beginForegroundRefresh
{
if (!_background) {
[_discMan startDiscovery];
// This will refresh the applist when a paired host is selected
if (_selectedHost != nil && _selectedHost.pairState == PairStatePaired) {
[self hostClicked:_selectedHost view:nil];
}
}
}
-(void)handleReturnToForeground -(void)handleReturnToForeground
{ {
_background = NO; _background = NO;
[_discMan startDiscovery]; [self beginForegroundRefresh];
// This will refresh the applist when a paired host is selected
if (_selectedHost != nil && _selectedHost.pairState == PairStatePaired) {
[self hostClicked:_selectedHost view:nil];
}
} }
-(void)handleEnterBackground -(void)handleEnterBackground
@@ -692,10 +699,14 @@ static NSMutableSet* hostList;
// since the stream view segues to us just before // since the stream view segues to us just before
// entering the background. We can't check the app // entering the background. We can't check the app
// state here (since it's in transition), so we have // state here (since it's in transition), so we have
// to use this variable that we set. // to use this function that will use our internal
if (!_background) { // state here to determine whether we're foreground.
[_discMan startDiscovery]; //
} // Note that this is neccessary here as we may enter
// this view via an error dialog from the stream
// view, so we won't get a return to active notification
// for that which would normally fire beginForegroundRefresh.
[self beginForegroundRefresh];
} }
- (void)viewDidDisappear:(BOOL)animated - (void)viewDidDisappear:(BOOL)animated