You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by to...@apache.org on 2016/05/23 13:42:44 UTC
[46/50] cordova-plugin-screen-orientation git commit: support
interoperability between Orientation preference and screen-orientation plugin
support interoperability between Orientation preference and screen-orientation plugin
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/commit/93757784
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/tree/93757784
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/diff/93757784
Branch: refs/heads/master
Commit: 937577842b37a2d67a231835067e4e4df87009be
Parents: a661578
Author: Tony Homer <to...@intel.com>
Authored: Mon May 16 14:24:44 2016 -0400
Committer: Tony Homer <to...@intel.com>
Committed: Mon May 16 15:30:58 2016 -0400
----------------------------------------------------------------------
src/ios/YoikScreenOrientation.h | 1 +
src/ios/YoikScreenOrientation.m | 14 ++++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/93757784/src/ios/YoikScreenOrientation.h
----------------------------------------------------------------------
diff --git a/src/ios/YoikScreenOrientation.h b/src/ios/YoikScreenOrientation.h
index dd23599..f2d4c67 100644
--- a/src/ios/YoikScreenOrientation.h
+++ b/src/ios/YoikScreenOrientation.h
@@ -25,6 +25,7 @@
@interface YoikScreenOrientation : CDVPlugin
- (void)screenOrientation:(CDVInvokedUrlCommand *)command;
+@property (strong, nonatomic) NSArray *originalSupportedOrientations;
@end
http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/93757784/src/ios/YoikScreenOrientation.m
----------------------------------------------------------------------
diff --git a/src/ios/YoikScreenOrientation.m b/src/ios/YoikScreenOrientation.m
index 9ffe8fa..3008b0c 100644
--- a/src/ios/YoikScreenOrientation.m
+++ b/src/ios/YoikScreenOrientation.m
@@ -28,9 +28,19 @@
{
[self.commandDelegate runInBackground:^{
+ if(self.originalSupportedOrientations == nil) {
+ self.originalSupportedOrientations = [self.viewController valueForKey:@"supportedOrientations"];
+ }
+
NSArray* arguments = command.arguments;
NSString* orientationIn = [arguments objectAtIndex:1];
+ if ([orientationIn isEqual: @"unlocked"]) {
+ [(CDVViewController*)self.viewController updateSupportedOrientations:self.originalSupportedOrientations];
+ self.originalSupportedOrientations = nil;
+ return;
+ }
+
// grab the device orientation so we can pass it back to the js side.
NSString *orientation;
switch ([[UIDevice currentDevice] orientation]) {
@@ -51,10 +61,6 @@
break;
}
- if ([orientationIn isEqual: @"unlocked"]) {
- orientationIn = orientation;
- }
-
// we send the result prior to the view controller presentation so that the JS side
// is ready for the unlock call.
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org