Fix the LoadingFrameViewController not display on top of other content on tvOS

Also remove hacks that were put in place due to this bug previously.
This commit is contained in:
Cameron Gutman
2020-04-19 14:40:39 -07:00
parent 084018719a
commit 3cca55703e
2 changed files with 9 additions and 13 deletions
@@ -827,7 +827,7 @@ static NSMutableSet* hostList;
} }
#endif #endif
-(void)beginForegroundRefresh:(bool)refreshAppList -(void)beginForegroundRefresh
{ {
if (!_background) { if (!_background) {
// This will kick off box art caching // This will kick off box art caching
@@ -838,7 +838,7 @@ static NSMutableSet* hostList;
[_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
if (refreshAppList && _selectedHost != nil && _selectedHost.pairState == PairStatePaired) { if (_selectedHost != nil && _selectedHost.pairState == PairStatePaired) {
[self hostClicked:_selectedHost view:nil]; [self hostClicked:_selectedHost view:nil];
} }
} }
@@ -878,7 +878,7 @@ static NSMutableSet* hostList;
{ {
_background = NO; _background = NO;
[self beginForegroundRefresh: YES]; [self beginForegroundRefresh];
// Check for a pending shortcut action when returning to foreground // Check for a pending shortcut action when returning to foreground
[self handlePendingShortcutAction]; [self handlePendingShortcutAction];
@@ -935,12 +935,7 @@ static NSMutableSet* hostList;
// this view via an error dialog from the stream // this view via an error dialog from the stream
// view, so we won't get a return to active notification // view, so we won't get a return to active notification
// for that which would normally fire beginForegroundRefresh. // for that which would normally fire beginForegroundRefresh.
// [self beginForegroundRefresh];
// On tvOS, we'll get a viewWillAppear when returning from the
// loading frame which will cause an infinite loop by starting
// another loading frame. To avoid this, just don't refresh
// if we're coming back from a loading frame view.
[self beginForegroundRefresh: !([_loadingFrame isShown] || [_loadingFrame isBeingDismissed])];
} }
- (void)viewDidDisappear:(BOOL)animated - (void)viewDidDisappear:(BOOL)animated
+5 -4
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="14868" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pui-7y-JNH"> <document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="16096" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pui-7y-JNH">
<device id="appleTV" appearance="dark"/> <device id="appleTV" appearance="dark"/>
<dependencies> <dependencies>
<deployment identifier="tvOS"/> <deployment identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@@ -73,12 +73,12 @@
<!--Loading Frame View Controller--> <!--Loading Frame View Controller-->
<scene sceneID="lqn-qp-p7w"> <scene sceneID="lqn-qp-p7w">
<objects> <objects>
<viewController storyboardIdentifier="loadingFrame" id="Ap5-6u-5Wo" customClass="LoadingFrameViewController" sceneMemberID="viewController"> <viewController storyboardIdentifier="loadingFrame" modalTransitionStyle="crossDissolve" modalPresentationStyle="overCurrentContext" id="Ap5-6u-5Wo" customClass="LoadingFrameViewController" sceneMemberID="viewController">
<layoutGuides> <layoutGuides>
<viewControllerLayoutGuide type="top" id="AfI-ck-OwD"/> <viewControllerLayoutGuide type="top" id="AfI-ck-OwD"/>
<viewControllerLayoutGuide type="bottom" id="DNo-dy-ucM"/> <viewControllerLayoutGuide type="bottom" id="DNo-dy-ucM"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="TIa-HJ-DIv"> <view key="view" clearsContextBeforeDrawing="NO" contentMode="center" id="TIa-HJ-DIv">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/> <rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
@@ -87,6 +87,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</activityIndicatorView> </activityIndicatorView>
</subviews> </subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="3xZ-qb-ZmB"/> <viewLayoutGuide key="safeArea" id="3xZ-qb-ZmB"/>
</view> </view>
<connections> <connections>