Skip to content

Commit

Permalink
Prevent Orientation change when already in the orientation. (for port…
Browse files Browse the repository at this point in the history
…rait and landscape lock)
  • Loading branch information
fortunes-technology committed Dec 7, 2017
1 parent b3ceb77 commit 9465d8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ios/CDVOrientation.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ -(void)screenOrientation:(CDVInvokedUrlCommand *)command

if ([UIDevice currentDevice] != nil){
NSNumber *value = nil;
if(orientationMask == 8 || orientationMask == 12) {
UIInterfaceOrientation deviceOrientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientationMask == 8 || (orientationMask == 12 && !UIInterfaceOrientationIsLandscape(deviceOrientation))) {
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
} else if (orientationMask == 4){
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
} else if (orientationMask == 1 || orientationMask == 3) {
} else if (orientationMask == 1 || (orientationMask == 3 && !UIInterfaceOrientationIsPortrait(deviceOrientation))) {
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
} else if (orientationMask == 2) {
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
Expand Down

0 comments on commit 9465d8c

Please sign in to comment.