erisu commented on code in PR #102:
URL: 
https://github.com/apache/cordova-plugin-screen-orientation/pull/102#discussion_r977895652


##########
src/ios/CDVOrientation.m:
##########
@@ -80,7 +80,13 @@ -(void)screenOrientation:(CDVInvokedUrlCommand *)command
             }
             if (value != nil) {
                 _isLocked = true;
-                [[UIDevice currentDevice] setValue:value 
forKey:@"orientation"];
+                if (@available(iOS 16.0, *)) {
+                    #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_15_5 // 
Xcode 14 and iOS 16, or greater
+                        [self.viewController 
setNeedsUpdateOfSupportedInterfaceOrientations];
+                    #endif

Review Comment:
   ```
   #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_15_5
   if (@available(iOS 16.0, *)) {
     [self.viewController setNeedsUpdateOfSupportedInterfaceOrientations];
   } else
   #endif
   {
     [UINavigationController attemptRotationToDeviceOrientation];
   }
   ```
   
   Should be better.



##########
src/ios/CDVOrientation.m:
##########
@@ -80,7 +80,13 @@ -(void)screenOrientation:(CDVInvokedUrlCommand *)command
             }
             if (value != nil) {
                 _isLocked = true;
-                [[UIDevice currentDevice] setValue:value 
forKey:@"orientation"];
+                if (@available(iOS 16.0, *)) {
+                    #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_15_5 // 
Xcode 14 and iOS 16, or greater
+                        [self.viewController 
setNeedsUpdateOfSupportedInterfaceOrientations];
+                    #endif

Review Comment:
   ```objectivec
   #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_15_5
   if (@available(iOS 16.0, *)) {
     [self.viewController setNeedsUpdateOfSupportedInterfaceOrientations];
   } else
   #endif
   {
     [UINavigationController attemptRotationToDeviceOrientation];
   }
   ```
   
   Should be better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to