You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/20 17:44:37 UTC

[GitHub] [cordova-plugin-screen-orientation] Hanzofm opened a new issue #80: Wrong Behaviour on iOS Devices

Hanzofm opened a new issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   
   -screenOrientation is unlocked and the user rotate to landscape the device.
   
   -Users execute (when is already in landscape mode) :
   
   `screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY);`
   
   -the ui rotates to portrait
   
   Then:
   
   `screenOrientation.unlock();`
   
   The orientation should keep on Portrait mode
   
   ### What does actually happen?
   
   After locked ui into `this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY` being in landscape orientation if unlock the orientation being in vertical orientation the ui returns to landscape mode automatically.
   
   ## Information
   -Same code works fine on Android
   -Tested on iOS devices 12 and 14
   
   ### Environment, Platform, Device
   iOS devices 12, ,13, 14 versions
   
   
   
   ### Version information
   ```
    Ionic CLI                     : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
    Ionic Framework               : @ionic/angular 5.2.3
    @angular-devkit/build-angular : 0.1000.3
    @angular-devkit/schematics    : 10.0.3
    @angular/cli                  : 10.0.3
    @ionic/angular-toolkit        : 2.3.3
   
   
     Cordova CLI       : 10.0.0
     Cordova Platforms :  ios 5.1.1
     Cordova Plugins   : "cordova-plugin-screen-orientation": "3.0.2",
   ```
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] WIStudent commented on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
WIStudent commented on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-850501277


   Unfortunately there are even more issues with the iOS implementation:
   
   1. Started with holding device in landscape-secondary and screen locked to landscape-secondary
   2. Rotate device to portrait-primary (counterclockwise)
   3. lock("portrait-primary")
   The screen does not rotate to portrait-primary but stays on landscape-secondary. Probably because the plugin thinks that it already reached portrait-primary but in reality only the device is being hold in portrait-primary while the screen is still in landscape-secondary. The screen will only rotate in the correct position if the counterclockwise rotation of the device is repeated (rotate the device to landscape-secondary and then back to portrait-primary). Then the screen will be rotated to portrait-primary and stay locked in that orientation.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] WIStudent commented on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
WIStudent commented on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-850474815


   I am having the same issue
   
   1. Started with holding device in portrait-primary position and screen locked to portrait-primary"
   2. unlock()
   3. rotate device to landscape-secondary (clockwise)
   window.screen.orientation change event fires
   window.screen.orientation.type is now "landscape-secondary"
   4. lock("landscape-secondary")
   No event fires because orientation has not changed
   5. lock("portrait")
   window.screen.orientation change event fires
   window.screen.orientation.type is now "portrait-primary"
   6. rotate device to portrait-primary (counter clockwise)
   Nothing happens because orientation is locked.
   7. unlock()
   screen rotates to "landscape-secondary"
   window.screen.orientation change event fires
   window.screen.orientation.type is now "landscape-secondary"
   
   The issue lies within step 7. Instead of just unlocking the orientation but keeping it as it is (or even better: updating it to the physical orientation of the device) the `unlock` call changes it back to the orientation that was active before the last `lock` call was made.
   
   Seeing that the last release of this plugin was 2 years ago I have little hope of actually getting a fix. Too bad capacitor relys on this plugin for its orientation handling.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] visuallization commented on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
visuallization commented on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-946622373


   We are experiencing the exact same problem @Hanzofm and @WIStudent have described. Are there any updates/solutions?


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] Hanzofm edited a comment on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
Hanzofm edited a comment on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-824074907


   The problem has a relationship with the code of CDVOrientation.m file:
   
   `  if (_lastOrientation != UIInterfaceOrientationUnknown) {
                       [[UIDevice currentDevice] setValue:[NSNumber numberWithInt:_lastOrientation] forKey:@"orientation"]; 
                       ((void (*)(CDVViewController*, SEL, NSMutableArray*))objc_msgSend)(vc,selector,result);
                       [UINavigationController attemptRotationToDeviceOrientation];
                   }`
   
   If comment the line:
   
   `[[UIDevice currentDevice] setValue:[NSNumber numberWithInt:_lastOrientation] forKey:@"orientation"]`
   
   The problem disappears.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] Hanzofm commented on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
Hanzofm commented on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-824074907


   The problem has a relationship with the code of CDVOrientation.m file:
   
   `  if (_lastOrientation != UIInterfaceOrientationUnknown) {
                       **[[UIDevice currentDevice] setValue:[NSNumber numberWithInt:_lastOrientation] forKey:@"orientation"]**; 
                       ((void (*)(CDVViewController*, SEL, NSMutableArray*))objc_msgSend)(vc,selector,result);
                       [UINavigationController attemptRotationToDeviceOrientation];
                   }`
   
   If comment the line:
   
   `[[UIDevice currentDevice] setValue:[NSNumber numberWithInt:_lastOrientation] forKey:@"orientation"]`
   
   The problem disappears.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] popcristi4 commented on issue #80: Wrong lock/unlock orientation behaviour on iOS Devices

Posted by GitBox <gi...@apache.org>.
popcristi4 commented on issue #80:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/80#issuecomment-888985849


   I have the same issue, I already opened an issue (https://github.com/apache/cordova-plugin-screen-orientation/issues/82) and only after saw @WIStudent's comment. It has a little more information and also some code of the implementation, so I will leave that issue open. If anybody has any input, please use the other issue, as this one is regarding the lock/unlock mechanism.


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org