stage manager & display orientation lock for iPhone

This commit is contained in:
TrueZhuanjia
2025-06-25 20:52:07 +08:00
parent 6bc142a07b
commit 357a907838
7 changed files with 33 additions and 35 deletions
+4 -4
View File
@@ -684,7 +684,7 @@
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="5dA-cw-gOa" userLabel="unlockDisplayOrientation Stack">
<rect key="frame" x="16" y="2140" width="380" height="56.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90° Display Rotation in Steaming" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hAo-1k-oYF" userLabel="Lock Display Orientation">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90° Display Rotation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hAo-1k-oYF" userLabel="Lock Display Orientation">
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -1442,16 +1442,16 @@
<image name="tray.full.fill" catalog="system" width="128" height="88"/>
<image name="video.and.waveform" catalog="system" width="128" height="94"/>
<systemColor name="linkColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
+1 -1
View File
@@ -1259,7 +1259,7 @@
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="FKE-J4-bZB" userLabel="unlockDisplayOrientation Stack">
<rect key="frame" x="16" y="2140" width="380" height="56.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90° Display Rotation in Steaming" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tO4-eD-VHF" userLabel="Lock Display Orientation">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90° Display Rotation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tO4-eD-VHF" userLabel="Lock Display Orientation">
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+1 -1
View File
@@ -76,7 +76,7 @@
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
@@ -795,7 +795,7 @@ const int FrontViewPositionNone = 0xff;
[self setupMenuSeparator];
}
- (bool)isIphone{
- (bool)isIPhone{
return ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
}
@@ -807,22 +807,20 @@ const int FrontViewPositionNone = 0xff;
else return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown;
}
- (BOOL)menuExpanded{
return _frontViewPosition != FrontViewPositionLeft;
}
// tested on iOS17.
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// Return the supported interface orientations acoordingly
if(!_isStreaming){
if([self isIphone]) return UIInterfaceOrientationMaskAll; //always try to lock orientaion to landscape in mainFrameView.
else return UIInterfaceOrientationMaskAll; //always try to lock current orientaion in mainFrameView for iPad in order to prevent bug.
}
//lock the orientation accordingly after streaming is started
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];
if(currentSettings.unlockDisplayOrientation){
return UIInterfaceOrientationMaskAll; // 90 Degree rotation will be allowed in streaming or app view
}
else return [self getCurrentOrientation]; // 90 Degree rotation not allowed in streaming or app view
NSLog(@"orientation unlocked: %d", currentSettings.unlockDisplayOrientation);
if(currentSettings.unlockDisplayOrientation) return UIInterfaceOrientationMaskAll;
else return [self isIPhone] ? UIInterfaceOrientationMaskLandscape : [self getCurrentOrientation];
}
- (void)viewDidLayoutSubviews{
@@ -1310,7 +1310,8 @@ BOOL isCustomResolution(CGSize res) {
[self updateResolutionDisplayLabel];
// Unlock Display Orientation setting
bool unlockDisplayOrientationSelectorEnabled = [self isFullScreenRequired];//need "requires fullscreen" enabled in the app bunddle to make runtime orientation limitation woring
// bool unlockDisplayOrientationSelectorEnabled = [self isFullScreenRequired];//need "requires fullscreen" enabled in the app bunddle to make runtime orientation limitation woring
bool unlockDisplayOrientationSelectorEnabled = true;
if(unlockDisplayOrientationSelectorEnabled) [self.unlockDisplayOrientationSelector setSelectedSegmentIndex:currentSettings.unlockDisplayOrientation ? 1 : 0];
else [self.unlockDisplayOrientationSelector setSelectedSegmentIndex:1]; // can't lock screen orientation in this mode = Display Orientation always unlocked
[self.unlockDisplayOrientationSelector setEnabled:unlockDisplayOrientationSelectorEnabled];
@@ -1960,7 +1961,6 @@ BOOL isCustomResolution(CGSize res) {
}
}
- (void) saveSettings {
DataManager* dataMan = [[DataManager alloc] init];
NSInteger framerate = [self getChosenFrameRate];
+8 -8
View File
@@ -1094,31 +1094,31 @@
}
},
"hAo-1k-oYF.text" : {
"comment" : "Class = \"UILabel\"; text = \"90° Display Rotation in Steaming\"; ObjectID = \"hAo-1k-oYF\";",
"comment" : "Class = \"UILabel\"; text = \"90° Display Rotation\"; ObjectID = \"hAo-1k-oYF\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "90° Display Rotation in Steaming"
"value" : "90° Display Rotation"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
}
}
+8 -8
View File
@@ -2174,31 +2174,31 @@
}
},
"tO4-eD-VHF.text" : {
"comment" : "Class = \"UILabel\"; text = \"90° Display Rotation in Steaming\"; ObjectID = \"tO4-eD-VHF\";",
"comment" : "Class = \"UILabel\"; text = \"90° Display Rotation\"; ObjectID = \"tO4-eD-VHF\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "90° Display Rotation in Steaming"
"value" : "90° Display Rotation"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "串流中90°转屏"
"state" : "needs_review",
"value" : "90°转屏"
}
}
}