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

View File

@@ -656,16 +656,23 @@ static NSMutableSet* hostList;
[[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
{
_background = NO;
[_discMan startDiscovery];
// This will refresh the applist when a paired host is selected
if (_selectedHost != nil && _selectedHost.pairState == PairStatePaired) {
[self hostClicked:_selectedHost view:nil];
}
[self beginForegroundRefresh];
}
-(void)handleEnterBackground
@@ -692,10 +699,14 @@ static NSMutableSet* hostList;
// since the stream view segues to us just before
// entering the background. We can't check the app
// state here (since it's in transition), so we have
// to use this variable that we set.
if (!_background) {
[_discMan startDiscovery];
}
// to use this function that will use our internal
// state here to determine whether we're foreground.
//
// 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