From 653a789110bbb3eab8c8eea6bb73d12a11c7699b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 1 Jun 2018 00:47:44 -0700 Subject: [PATCH] Refresh app and host state when returning from streaming via error --- .../ViewControllers/MainFrameViewController.m | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 33457f7..41c3a1c 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -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