runtime orientation limitation, tested on iOS17.2 (probably need iOS16+, not working with iOS14)

This commit is contained in:
True Zhuanjia
2024-07-13 13:55:10 +08:00
parent c72accb3cb
commit 2de3197ca9
16 changed files with 310 additions and 37 deletions
+10 -5
View File
@@ -25,19 +25,24 @@ static NSString* DB_NAME = @"Limelight_iOS.sqlite";
#if !TARGET_OS_TV #if !TARGET_OS_TV
/*
// orietation limitatioin test // orietation limitatioin test
/*- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
UIViewController *topController = window.rootViewController; UIViewController *topController = window.rootViewController;
while (topController.presentedViewController) { while (topController.presentedViewController) {
topController = topController.presentedViewController; topController = topController.presentedViewController;
} }
return [topController supportedInterfaceOrientations]; return [topController supportedInterfaceOrientations];
}*/
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return UIInterfaceOrientationMaskAll;
} }
*/
/*
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
NSLog(@"orientation limit");
return UIInterfaceOrientationMaskLandscape;
}
*/
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler { - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
_pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"]; _pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"];
+23 -2
View File
@@ -428,6 +428,23 @@ ICAgICAgICAgICAgICA
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</segmentedControl> </segmentedControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Allow Portrait" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hAo-1k-oYF" userLabel="Allow Portrait">
<rect key="frame" x="16" y="1596" width="102" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="7Gm-zB-s7s" userLabel="Allow Portrait">
<rect key="frame" x="16" y="1625" width="459" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="No"/>
<segment title="Yes"/>
</segments>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</segmentedControl>
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="lcO-6v-Tbg" userLabel="ABXY Swap Selector"> <segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="lcO-6v-Tbg" userLabel="ABXY Swap Selector">
<rect key="frame" x="16" y="1150" width="459" height="28"/> <rect key="frame" x="16" y="1150" width="459" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -445,7 +462,7 @@ ICAgICAgICAgICAgICA
<buttonConfiguration key="configuration" style="tinted" title="Exit"> <buttonConfiguration key="configuration" style="tinted" title="Exit">
<backgroundConfiguration key="background"/> <backgroundConfiguration key="background"/>
<fontDescription key="titleFontDescription" type="system" pointSize="17"/> <fontDescription key="titleFontDescription" type="system" pointSize="17"/>
<color key="baseForegroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="baseForegroundColor" systemColor="tintColor"/>
<color key="baseBackgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="baseBackgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration> </buttonConfiguration>
<connections> <connections>
@@ -459,7 +476,7 @@ ICAgICAgICAgICAgICA
<buttonConfiguration key="configuration" style="tinted" title="Go Back to Stream View"> <buttonConfiguration key="configuration" style="tinted" title="Go Back to Stream View">
<backgroundConfiguration key="background"/> <backgroundConfiguration key="background"/>
<fontDescription key="titleFontDescription" type="system" pointSize="17"/> <fontDescription key="titleFontDescription" type="system" pointSize="17"/>
<color key="baseForegroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="baseForegroundColor" systemColor="tintColor"/>
<color key="baseBackgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="baseBackgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration> </buttonConfiguration>
<connections> <connections>
@@ -471,6 +488,7 @@ ICAgICAgICAgICAgICA
</view> </view>
<size key="freeformSize" width="586" height="2500"/> <size key="freeformSize" width="586" height="2500"/>
<connections> <connections>
<outlet property="allowPortraitSelector" destination="7Gm-zB-s7s" id="Pwv-qw-LnF"/>
<outlet property="audioOnPCSelector" destination="WDY-9o-6Hb" id="ntW-H9-Ahp"/> <outlet property="audioOnPCSelector" destination="WDY-9o-6Hb" id="ntW-H9-Ahp"/>
<outlet property="bitrateLabel" destination="lMt-4H-fkV" id="ItM-l3-1Jk"/> <outlet property="bitrateLabel" destination="lMt-4H-fkV" id="ItM-l3-1Jk"/>
<outlet property="bitrateSlider" destination="JAY-nj-UNz" id="fHd-v5-9Vo"/> <outlet property="bitrateSlider" destination="JAY-nj-UNz" id="fHd-v5-9Vo"/>
@@ -833,6 +851,9 @@ ICAgICAgICAgICAgICA
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="tintColor">
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="viewFlipsideBackgroundColor"> <systemColor name="viewFlipsideBackgroundColor">
<color red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
+23 -2
View File
@@ -463,7 +463,7 @@ ICAgICAgICAgICAgIA
<state key="normal" title="Button"/> <state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="tinted" title="Exit"> <buttonConfiguration key="configuration" style="tinted" title="Exit">
<fontDescription key="titleFontDescription" type="boldSystem" pointSize="17"/> <fontDescription key="titleFontDescription" type="boldSystem" pointSize="17"/>
<color key="baseForegroundColor" red="0.95294117649999999" green="0.97647058819999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="baseForegroundColor" systemColor="tintColor"/>
<color key="baseBackgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="baseBackgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration> </buttonConfiguration>
<connections> <connections>
@@ -476,18 +476,36 @@ ICAgICAgICAgICAgIA
<state key="normal" title="Button"/> <state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="tinted" title="Go Back to Stream View"> <buttonConfiguration key="configuration" style="tinted" title="Go Back to Stream View">
<fontDescription key="titleFontDescription" type="boldSystem" pointSize="17"/> <fontDescription key="titleFontDescription" type="boldSystem" pointSize="17"/>
<color key="baseForegroundColor" red="0.95294117649999999" green="0.97647058819999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="baseForegroundColor" systemColor="tintColor"/>
<color key="baseBackgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="baseBackgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration> </buttonConfiguration>
<connections> <connections>
<action selector="goBackToStreamViewButtonTapped:" destination="rYd-e6-cQU" eventType="touchUpInside" id="9P0-Yw-T4W"/> <action selector="goBackToStreamViewButtonTapped:" destination="rYd-e6-cQU" eventType="touchUpInside" id="9P0-Yw-T4W"/>
</connections> </connections>
</button> </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Allow Portrait" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z9P-TN-kci">
<rect key="frame" x="20" y="1550" width="208" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="R9O-Tw-UD4" userLabel="Allow Portrait">
<rect key="frame" x="19" y="1579" width="450" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="No"/>
<segment title="Yes"/>
</segments>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</segmentedControl>
</subviews> </subviews>
<color key="backgroundColor" red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view> </view>
<size key="freeformSize" width="500" height="1900"/> <size key="freeformSize" width="500" height="1900"/>
<connections> <connections>
<outlet property="allowPortraitSelector" destination="R9O-Tw-UD4" id="0ak-pc-eva"/>
<outlet property="audioOnPCSelector" destination="8GA-Js-kQN" id="Gab-Tb-Syy"/> <outlet property="audioOnPCSelector" destination="8GA-Js-kQN" id="Gab-Tb-Syy"/>
<outlet property="bitrateLabel" destination="SBv-Wn-LB7" id="Wdu-me-Bvd"/> <outlet property="bitrateLabel" destination="SBv-Wn-LB7" id="Wdu-me-Bvd"/>
<outlet property="bitrateSlider" destination="3nn-MI-9Xu" id="IuD-Rk-vPp"/> <outlet property="bitrateSlider" destination="3nn-MI-9Xu" id="IuD-Rk-vPp"/>
@@ -829,5 +847,8 @@ ICAgICAgICAgICAgIA
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="tintColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources> </resources>
</document> </document>
+2 -1
View File
@@ -37,7 +37,8 @@
btMouseSupport:(BOOL)btMouseSupport btMouseSupport:(BOOL)btMouseSupport
// absoluteTouchMode:(BOOL)absoluteTouchMode // absoluteTouchMode:(BOOL)absoluteTouchMode
touchMode:(NSInteger)touchMode touchMode:(NSInteger)touchMode
statsOverlay:(BOOL)statsOverlay; statsOverlay:(BOOL)statsOverlay
allowPortrait:(BOOL)allowPortrait;
- (NSArray*) getHosts; - (NSArray*) getHosts;
- (void) updateHost:(TemporaryHost*)host; - (void) updateHost:(TemporaryHost*)host;
+3 -1
View File
@@ -76,7 +76,8 @@
btMouseSupport:(BOOL)btMouseSupport btMouseSupport:(BOOL)btMouseSupport
// absoluteTouchMode:(BOOL)absoluteTouchMode // absoluteTouchMode:(BOOL)absoluteTouchMode
touchMode:(NSInteger)touchMode touchMode:(NSInteger)touchMode
statsOverlay:(BOOL)statsOverlay { statsOverlay:(BOOL)statsOverlay
allowPortrait:(BOOL)allowPortrait{
[_managedObjectContext performBlockAndWait:^{ [_managedObjectContext performBlockAndWait:^{
Settings* settingsToSave = [self retrieveSettings]; Settings* settingsToSave = [self retrieveSettings];
@@ -105,6 +106,7 @@
// settingsToSave.absoluteTouchMode = absoluteTouchMode; // settingsToSave.absoluteTouchMode = absoluteTouchMode;
settingsToSave.touchMode = [NSNumber numberWithInteger:(uint16_t)touchMode]; settingsToSave.touchMode = [NSNumber numberWithInteger:(uint16_t)touchMode];
settingsToSave.statsOverlay = statsOverlay; settingsToSave.statsOverlay = statsOverlay;
settingsToSave.allowPortrait = allowPortrait;
[self saveData]; [self saveData];
}]; }];
+1
View File
@@ -48,6 +48,7 @@
@property (nonatomic) BOOL statsOverlay; @property (nonatomic) BOOL statsOverlay;
@property (nonatomic) BOOL liftStreamViewForKeyboard; @property (nonatomic) BOOL liftStreamViewForKeyboard;
@property (nonatomic) BOOL showKeyboardToolbar; @property (nonatomic) BOOL showKeyboardToolbar;
@property (nonatomic) BOOL allowPortrait;
- (id) initFromSettings:(Settings*)settings; - (id) initFromSettings:(Settings*)settings;
+1
View File
@@ -94,6 +94,7 @@
self.touchPointerVelocityFactor = settings.touchPointerVelocityFactor; self.touchPointerVelocityFactor = settings.touchPointerVelocityFactor;
self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor; self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor;
self.pointerVelocityModeDivider = settings.pointerVelocityModeDivider; self.pointerVelocityModeDivider = settings.pointerVelocityModeDivider;
self.allowPortrait = settings.allowPortrait;
#endif #endif
self.uniqueId = settings.uniqueId; self.uniqueId = settings.uniqueId;
@@ -21,6 +21,7 @@
<relationship name="appList" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="App" inverseName="host" inverseEntity="App" syncable="YES"/> <relationship name="appList" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="App" inverseName="host" inverseEntity="App" syncable="YES"/>
</entity> </entity>
<entity name="Settings" representedClassName="Settings" syncable="YES" codeGenerationType="class"> <entity name="Settings" representedClassName="Settings" syncable="YES" codeGenerationType="class">
<attribute name="allowPortrait" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="audioConfig" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/> <attribute name="audioConfig" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/>
<attribute name="bitrate" attributeType="Integer 32" defaultValueString="10000" usesScalarValueType="NO" syncable="YES"/> <attribute name="bitrate" attributeType="Integer 32" defaultValueString="10000" usesScalarValueType="NO" syncable="YES"/>
<attribute name="btMouseSupport" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/> <attribute name="btMouseSupport" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
@@ -21,7 +21,6 @@
#if !TARGET_OS_TV #if !TARGET_OS_TV
@property (weak, nonatomic) IBOutlet UIBarButtonItem *upButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *upButton;
@property (nonatomic, assign) bool settingsExpandedInStreamView; @property (nonatomic, assign) bool settingsExpandedInStreamView;
@property (nonatomic, assign) bool isInHostView;
-(void)simulateSettingsButtonPress; -(void)simulateSettingsButtonPress;
-(void)reloadStreamConfig; -(void)reloadStreamConfig;
@@ -43,7 +43,7 @@
@implementation MainFrameViewController { @implementation MainFrameViewController {
UILabel* waterMark; UILabel* waterMark;
CGFloat recordedScreenWidth; //CGFloat recordedScreenWidth;
CustomEdgeSwipeGestureRecognizer* _exitSwipeRecognizer; CustomEdgeSwipeGestureRecognizer* _exitSwipeRecognizer;
NSOperationQueue* _opQueue; NSOperationQueue* _opQueue;
TemporaryHost* _selectedHost; TemporaryHost* _selectedHost;
@@ -307,7 +307,6 @@ static NSMutableSet* hostList;
[self updateTitle]; [self updateTitle];
[self disableUpButton]; [self disableUpButton];
self.isInHostView = true; // setting flag
[self reloadScrollHostView]; // host view must be reloaded here [self reloadScrollHostView]; // host view must be reloaded here
[self.collectionView reloadData]; [self.collectionView reloadData];
[self.view addSubview:hostScrollView]; [self.view addSubview:hostScrollView];
@@ -347,7 +346,6 @@ static NSMutableSet* hostList;
[self updateTitle]; [self updateTitle];
[self enableUpButton]; [self enableUpButton];
[self disableNavigation]; [self disableNavigation];
self.isInHostView = false;
#if TARGET_OS_TV #if TARGET_OS_TV
// Intercept the menu key to go back to the host page // Intercept the menu key to go back to the host page
@@ -610,6 +608,7 @@ static NSMutableSet* hostList;
} }
- (void) prepareToStreamApp:(TemporaryApp *)app { - (void) prepareToStreamApp:(TemporaryApp *)app {
self.revealViewController.isStreaming = true; // tell the revealViewController streaming is started.
_streamConfig = [[StreamConfiguration alloc] init]; _streamConfig = [[StreamConfiguration alloc] init];
_streamConfig.host = app.host.activeAddress; _streamConfig.host = app.host.activeAddress;
_streamConfig.httpsPort = app.host.httpsPort; _streamConfig.httpsPort = app.host.httpsPort;
@@ -893,32 +892,32 @@ static NSMutableSet* hostList;
} }
} }
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// Return the supported interface orientations based on the current state
NSLog(@"orchange test");
return UIInterfaceOrientationMaskLandscape;
}
- (void)handleOrientationChange { - (void)handleOrientationChange {
double delayInSeconds = 0.7; double delayInSeconds = 0.7;
// Convert the delay into a dispatch_time_t value // Convert the delay into a dispatch_time_t value
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
// Perform some task after the delay // Perform some task after the delay
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]); //CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay
[self swapResolutionWidthHeightAccordingly]; [self swapResolutionWidthHeightAccordingly];
if(self.isInHostView) [self reloadScrollHostView]; // here is a flag for judging whether to reload host view after orientation change. if([self->_upButton title] == nil) [self reloadScrollHostView]; // title of the _upButton is good flag for judging if we're on the Host selection view
self->recordedScreenWidth = screenWidthInPoints; // kind of obselete, but i keep this in the code. //self->recordedScreenWidth = screenWidthInPoints; // kind of obselete, but i keep this in the code.
}); });
} }
// currently obselete:
- (void) setNeedsUpdateAllowedOrientation{
if (@available(iOS 16.0, *)) {
[self setNeedsUpdateOfSupportedInterfaceOrientations];
} else {
// Fallback on earlier versions
}
}
- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position { - (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position {
[self setNeedsUpdateOfSupportedInterfaceOrientations]; // If we moved back to the center position, we should save the settings
// If we moved back to the center position, we should save the settings
SettingsViewController* settingsViewController = (SettingsViewController*)[revealController rearViewController]; SettingsViewController* settingsViewController = (SettingsViewController*)[revealController rearViewController];
settingsViewController.mainFrameViewController = self; settingsViewController.mainFrameViewController = self;
@@ -936,6 +935,7 @@ static NSMutableSet* hostList;
if (position == FrontViewPositionLeft) { if (position == FrontViewPositionLeft) {
[settingsViewController saveSettings]; [settingsViewController saveSettings];
[self setNeedsUpdateAllowedOrientation]; // handle allow portratit on & off
_settingsButton.enabled = YES; // make sure these 2 buttons are enabled after closing setting view. _settingsButton.enabled = YES; // make sure these 2 buttons are enabled after closing setting view.
_upButton.enabled = YES; // here is the select new host button _upButton.enabled = YES; // here is the select new host button
} }
@@ -1024,7 +1024,7 @@ static NSMutableSet* hostList;
[self attachWaterMark]; [self attachWaterMark];
#if !TARGET_OS_TV #if !TARGET_OS_TV
self.settingsExpandedInStreamView = false; // init this flag self.settingsExpandedInStreamView = false; // init this flag
self.isInHostView = true; self.revealViewController.isStreaming = false; //init this flag for rvlVC
// Set the side bar button action. When it's tapped, it'll show the sidebar. // Set the side bar button action. When it's tapped, it'll show the sidebar.
[_settingsButton setTarget:self.revealViewController]; [_settingsButton setTarget:self.revealViewController];
@@ -1080,7 +1080,7 @@ static NSMutableSet* hostList;
_boxArtCache = [[NSCache alloc] init]; _boxArtCache = [[NSCache alloc] init];
recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]); //recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]);
hostScrollView = [[ComputerScrollView alloc] init]; hostScrollView = [[ComputerScrollView alloc] init];
[self reloadScrollHostView]; [self reloadScrollHostView];
@@ -1100,8 +1100,8 @@ static NSMutableSet* hostList;
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]); CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]); CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
// deal with scroll host view reload after device orientation change here:
bool isLandscape = screenWidthInPoints > screenHeightInPoints; bool isLandscape = screenWidthInPoints > screenHeightInPoints;
NSLog(@"isLandscape1 %d", isLandscape);
CGFloat realViewFrameWidth = self.view.frame.size.width > self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height; CGFloat realViewFrameWidth = self.view.frame.size.width > self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height;
CGFloat realViewFrameHeight = self.view.frame.size.width < self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height; CGFloat realViewFrameHeight = self.view.frame.size.width < self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height;
if(!isLandscape) { if(!isLandscape) {
@@ -1253,8 +1253,9 @@ static NSMutableSet* hostList;
object:nil]; object:nil];
[[self revealViewController] setPrimaryViewController:self]; [[self revealViewController] setPrimaryViewController:self];
recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]); // Get the screen's bounds (in points), update recorded screen width self.revealViewController.isStreaming = false; // tell the revealViewController streaming is finished
self.isInHostView = true;
//recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]); // Get the screen's bounds (in points), update recorded screen width
#endif #endif
[self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setNavigationBarHidden:NO animated:YES];
@@ -311,6 +311,8 @@ typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType)
// Delegate // Delegate
@property (nonatomic,weak) id<SWRevealViewControllerDelegate> delegate; @property (nonatomic,weak) id<SWRevealViewControllerDelegate> delegate;
@property (nonatomic,assign) bool isStreaming;
@end @end
@@ -27,6 +27,7 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import "SWRevealViewController.h" #import "SWRevealViewController.h"
#import "DataManager.h"
#pragma mark - StatusBar Helper Function #pragma mark - StatusBar Helper Function
@@ -719,6 +720,36 @@ const int FrontViewPositionNone = 0xff;
} }
- (UIInterfaceOrientationMask)getCurrentOrientation{
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
//lock the orientation accordingly after streaming is started
if(screenWidthInPoints > screenHeightInPoints) return UIInterfaceOrientationMaskLandscape;
else return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown;
}
// tested on iOS17. this method does not call back on iOS14, so runtime orientation limitation not working for iOS14. Probably depends on iOS16 or higher.
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// Return the supported interface orientations based on the current state
NSLog(@"supportedInterfaceOrientations called back 666");
//lock the orientation accordingly after streaming is started
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];
//Handle allow portrait on & off
if(currentSettings.allowPortrait){
if (self.isStreaming) return [self getCurrentOrientation];
else return UIInterfaceOrientationMaskAll;
}
else return UIInterfaceOrientationMaskLandscape;
}
- (void)viewDidLoad{
self.isStreaming = false; //init this flag
}
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
@@ -1233,7 +1264,7 @@ const int FrontViewPositionNone = 0xff;
CGFloat translation = [recognizer translationInView:_contentView].x; CGFloat translation = [recognizer translationInView:_contentView].x;
CGFloat baseLocation = [_contentView frontLocationForPosition:_panInitialFrontPosition]; CGFloat baseLocation = [_contentView frontLocationForPosition:_panInitialFrontPosition];
CGFloat xLocation = baseLocation + translation; CGFloat xLocation = baseLocation + translation; // buggy on portrait mode??/
if ( xLocation < 0 ) if ( xLocation < 0 )
{ {
@@ -45,11 +45,13 @@
@property (strong, nonatomic) IBOutlet UILabel *touchPointerVelocityFactorUILabel; @property (strong, nonatomic) IBOutlet UILabel *touchPointerVelocityFactorUILabel;
@property (strong, nonatomic) IBOutlet UISlider *mousePointerVelocityFactorSlider; @property (strong, nonatomic) IBOutlet UISlider *mousePointerVelocityFactorSlider;
@property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel; @property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel;
@property (strong, nonatomic) IBOutlet UISegmentedControl *allowPortraitSelector;
@property (strong, nonatomic) IBOutlet UIButton *goBackToStreamViewButton; @property (strong, nonatomic) IBOutlet UIButton *goBackToStreamViewButton;
@property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC; @property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC;
@property (nonatomic, strong) MainFrameViewController *mainFrameViewController; @property (nonatomic, strong) MainFrameViewController *mainFrameViewController;
@property (nonatomic, strong) CustomEdgeSwipeGestureRecognizer *exitSwipeRecognizer; @property (nonatomic, strong) CustomEdgeSwipeGestureRecognizer *exitSwipeRecognizer;
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability" #pragma clang diagnostic ignored "-Wunguarded-availability"
@@ -392,6 +392,9 @@ BOOL isCustomResolution(CGSize res) {
[self updateBitrateText]; [self updateBitrateText];
[self updateResolutionDisplayViewText]; [self updateResolutionDisplayViewText];
// allow portrait setting
[self.allowPortraitSelector setSelectedSegmentIndex:currentSettings.allowPortrait ? 1 : 0];
// lift streamview setting // lift streamview setting
[self.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:currentSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting [self.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:currentSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting
@@ -882,6 +885,7 @@ BOOL isCustomResolution(CGSize res) {
NSInteger touchMode = [self.touchModeSelector selectedSegmentIndex]; NSInteger touchMode = [self.touchModeSelector selectedSegmentIndex];
BOOL statsOverlay = [self.statsOverlaySelector selectedSegmentIndex] == 1; BOOL statsOverlay = [self.statsOverlaySelector selectedSegmentIndex] == 1;
BOOL enableHdr = [self.hdrSelector selectedSegmentIndex] == 1; BOOL enableHdr = [self.hdrSelector selectedSegmentIndex] == 1;
BOOL allowPortrait = [self.allowPortraitSelector selectedSegmentIndex] == 1;
[dataMan saveSettingsWithBitrate:_bitrate [dataMan saveSettingsWithBitrate:_bitrate
framerate:framerate framerate:framerate
height:height height:height
@@ -906,7 +910,8 @@ BOOL isCustomResolution(CGSize res) {
btMouseSupport:btMouseSupport btMouseSupport:btMouseSupport
// absoluteTouchMode:absoluteTouchMode // absoluteTouchMode:absoluteTouchMode
touchMode:touchMode touchMode:touchMode
statsOverlay:statsOverlay]; statsOverlay:statsOverlay
allowPortrait:allowPortrait];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
+90
View File
@@ -31,6 +31,66 @@
} }
} }
}, },
"7Gm-zB-s7s.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; 7Gm-zB-s7s.segmentTitles[0] = \"No\"; ObjectID = \"7Gm-zB-s7s\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "No"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
}
}
},
"7Gm-zB-s7s.segmentTitles[1]" : {
"comment" : "Class = \"UISegmentedControl\"; 7Gm-zB-s7s.segmentTitles[1] = \"Yes\"; ObjectID = \"7Gm-zB-s7s\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Yes"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
}
}
},
"7va-uJ-IfD.segmentTitles[0]" : { "7va-uJ-IfD.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; 7va-uJ-IfD.segmentTitles[0] = \"Lowest Latency\"; ObjectID = \"7va-uJ-IfD\";", "comment" : "Class = \"UISegmentedControl\"; 7va-uJ-IfD.segmentTitles[0] = \"Lowest Latency\"; ObjectID = \"7va-uJ-IfD\";",
"extractionState" : "extracted_with_value", "extractionState" : "extracted_with_value",
@@ -817,6 +877,36 @@
} }
} }
}, },
"hAo-1k-oYF.text" : {
"comment" : "Class = \"UILabel\"; text = \"Allow Portrait\"; ObjectID = \"hAo-1k-oYF\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Allow Portrait"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
}
}
},
"hm3-EV-h6d.segmentTitles[0]" : { "hm3-EV-h6d.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; hm3-EV-h6d.segmentTitles[0] = \"No\"; ObjectID = \"hm3-EV-h6d\";", "comment" : "Class = \"UISegmentedControl\"; hm3-EV-h6d.segmentTitles[0] = \"No\"; ObjectID = \"hm3-EV-h6d\";",
"extractionState" : "extracted_with_value", "extractionState" : "extracted_with_value",
+90
View File
@@ -1627,6 +1627,66 @@
} }
} }
}, },
"R9O-Tw-UD4.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; R9O-Tw-UD4.segmentTitles[0] = \"No\"; ObjectID = \"R9O-Tw-UD4\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "No"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭"
}
}
}
},
"R9O-Tw-UD4.segmentTitles[1]" : {
"comment" : "Class = \"UISegmentedControl\"; R9O-Tw-UD4.segmentTitles[1] = \"Yes\"; ObjectID = \"R9O-Tw-UD4\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Yes"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "启用"
}
}
}
},
"rdz-eg-2oR.segmentTitles[0]" : { "rdz-eg-2oR.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; rdz-eg-2oR.segmentTitles[0] = \"No\"; ObjectID = \"rdz-eg-2oR\";", "comment" : "Class = \"UISegmentedControl\"; rdz-eg-2oR.segmentTitles[0] = \"No\"; ObjectID = \"rdz-eg-2oR\";",
"extractionState" : "extracted_with_value", "extractionState" : "extracted_with_value",
@@ -2028,6 +2088,36 @@
} }
} }
} }
},
"Z9P-TN-kci.text" : {
"comment" : "Class = \"UILabel\"; text = \"Allow Portrait\"; ObjectID = \"Z9P-TN-kci\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Allow Portrait"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "允许竖屏"
}
}
}
} }
}, },
"version" : "1.0" "version" : "1.0"