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,10 +656,9 @@ static NSMutableSet* hostList;
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
-(void)handleReturnToForeground -(void)beginForegroundRefresh
{ {
_background = NO; if (!_background) {
[_discMan startDiscovery]; [_discMan startDiscovery];
// This will refresh the applist when a paired host is selected // This will refresh the applist when a paired host is selected
@@ -667,6 +666,14 @@ static NSMutableSet* hostList;
[self hostClicked:_selectedHost view:nil]; [self hostClicked:_selectedHost view:nil];
} }
} }
}
-(void)handleReturnToForeground
{
_background = NO;
[self beginForegroundRefresh];
}
-(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