From c3a8317d785b49bf2a323b935165f48afd508de6 Mon Sep 17 00:00:00 2001 From: Brian Weasner <84519320+brian-weasner@users.noreply.github.com> Date: Thu, 18 Apr 2024 08:53:09 -0500 Subject: [PATCH] bug(@capacitor/screen-orientation): iOS landscape lock using incorrect mappings (#2049) --- .../ScreenOrientation.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift b/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift index 149aa88d7..c1e9e1e08 100644 --- a/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift +++ b/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift @@ -85,9 +85,11 @@ public class ScreenOrientation: NSObject { case "any": return UIInterfaceOrientationMask.all case "landscape", "landscape-primary": - return UIInterfaceOrientationMask.landscapeLeft - case "landscape-secondary": + // UIInterfaceOrientationMask.landscapeRight is the same as UIDeviceOrientation.landscapeLeft return UIInterfaceOrientationMask.landscapeRight + case "landscape-secondary": + // UIInterfaceOrientationMask.landscapeLeft is the same as UIDeviceOrientation.landscapeRight + return UIInterfaceOrientationMask.landscapeLeft case "portrait-secondary": return UIInterfaceOrientationMask.portraitUpsideDown default: @@ -101,9 +103,15 @@ public class ScreenOrientation: NSObject { case "any": return UIInterfaceOrientation.unknown.rawValue case "landscape", "landscape-primary": - return UIInterfaceOrientation.landscapeLeft.rawValue - case "landscape-secondary": + // UIInterfaceOrientation.landscapeRight is the same as UIDeviceOrientation.landscapeLeft + // @see https://developer.apple.com/documentation/uikit/uiinterfaceorientation/landscaperight + // @see https://developer.apple.com/documentation/uikit/uideviceorientation/landscapeleft return UIInterfaceOrientation.landscapeRight.rawValue + case "landscape-secondary": + // UIInterfaceOrientation.landscapeLeft is the same as UIDeviceOrientation.landscapeRight + // @see https://developer.apple.com/documentation/uikit/uiinterfaceorientation/landscapeleft + // @see https://developer.apple.com/documentation/uikit/uideviceorientation/landscaperight + return UIInterfaceOrientation.landscapeLeft.rawValue case "portrait-secondary": return UIInterfaceOrientation.portraitUpsideDown.rawValue default: