From cc13b60411b7d3c433c4872a0d77a838f51c99d2 Mon Sep 17 00:00:00 2001 From: TrueZhuangjia Date: Tue, 28 Jan 2025 18:59:18 +0800 Subject: [PATCH] in mainFrameView, lock landscape orientation for iPhone, lock current orientation for iPad Fullscreen version --- .../Moonlight v1.10.xcdatamodel/contents | 4 ++-- .../ViewControllers/SWRevealViewController.m | 20 ++++++++++++------- Limelight/mul.lproj/iPad.xcstrings | 6 +++--- Limelight/mul.lproj/iPhone.xcstrings | 6 +++--- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents index 9776262a..c6733dac 100644 --- a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents +++ b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents @@ -38,7 +38,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/Limelight/ViewControllers/SWRevealViewController.m b/Limelight/ViewControllers/SWRevealViewController.m index 4b218798..694c2330 100755 --- a/Limelight/ViewControllers/SWRevealViewController.m +++ b/Limelight/ViewControllers/SWRevealViewController.m @@ -720,6 +720,9 @@ const int FrontViewPositionNone = 0xff; [self _setFrontViewPosition:initialPosition withDuration:0.0]; } +- (bool)isIphone{ + return ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); +} - (UIInterfaceOrientationMask)getCurrentOrientation{ CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]); @@ -732,18 +735,21 @@ const int FrontViewPositionNone = 0xff; // tested on iOS17. this method does not call back on iOS14, 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"); + // Return the supported interface orientations acoordingly + + if(self.mainFrameIsInHostView){ + if([self isIphone]) return UIInterfaceOrientationMaskLandscape; //always try to lock orientaion to landscape in mainFrameView in order to prevent bug. + else return [self getCurrentOrientation]; //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]; - //Handle Lock Display Orientation on & off - - if(self.mainFrameIsInHostView) return [self getCurrentOrientation]; //always try to lock orientaion in mainFrameView in order to prevent bug. + if(currentSettings.unlockDisplayOrientation){ - return UIInterfaceOrientationMaskAll; // 90 Degree rotation will be allowed in streaming + return UIInterfaceOrientationMaskAll; // 90 Degree rotation will be allowed in streaming or app view } - else return [self getCurrentOrientation]; + else return [self getCurrentOrientation]; // 90 Degree rotation not allowed in streaming or app view } diff --git a/Limelight/mul.lproj/iPad.xcstrings b/Limelight/mul.lproj/iPad.xcstrings index 2efc76ab..fc16b19c 100644 --- a/Limelight/mul.lproj/iPad.xcstrings +++ b/Limelight/mul.lproj/iPad.xcstrings @@ -1154,19 +1154,19 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } } } diff --git a/Limelight/mul.lproj/iPhone.xcstrings b/Limelight/mul.lproj/iPhone.xcstrings index 55346544..17c9efd7 100644 --- a/Limelight/mul.lproj/iPhone.xcstrings +++ b/Limelight/mul.lproj/iPhone.xcstrings @@ -2594,19 +2594,19 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "串流中允许90°转屏" + "value" : "允许90°转屏(App视图、串流时生效)" } } }