From 7a11a3dd7e8b37fe9948529750488a186f246917 Mon Sep 17 00:00:00 2001 From: tokotchd Date: Fri, 7 Aug 2015 12:12:10 -0400 Subject: [PATCH 1/3] Added Windows 8.1 Support Windows 8.1 has javascript calls, were not be complicated to add. --- README.md | 3 +++ package.json | 4 ++-- plugin.xml | 8 +++++++- www/screenorientation.windows.js | 33 ++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 www/screenorientation.windows.js diff --git a/README.md b/README.md index 2110622..805f1d3 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,9 @@ Windows phone does not support specification or primary and secondary orientatio # Changelog +## 1.3.7 +* Added Windows 8.1 Support + ## 1.3.5-6 * Plugin added to npm diff --git a/package.json b/package.json index 6430b2f..beecb69 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cordova-plugin-screen-orientation", - "version": "1.3.6", - "description": "Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8 and BB10.", + "version": "1.3.7", + "description": "Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10.", "repository": { "type": "git", "url": "git+https://github.com/gbenvenuti/cordova-plugin-screen-orientation.git" diff --git a/plugin.xml b/plugin.xml index b402633..5b96723 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,7 +5,7 @@ version="1.3.6"> Screen Orientation - Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8 and BB10. + Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10. MIT @@ -64,4 +64,10 @@ + + + + + + diff --git a/www/screenorientation.windows.js b/www/screenorientation.windows.js new file mode 100644 index 0000000..80edcf5 --- /dev/null +++ b/www/screenorientation.windows.js @@ -0,0 +1,33 @@ +var screenOrientation = {}; + +screenOrientation.lockOrientation = function (orientation) { + var orientationNumber; + switch (orientation) { + case 'landscape': + orientationNumber = 5; + break; + case 'portrait': + orientationNumber = 10; + break; + case 'landscape-primary': + orientationNumber = 1; + break; + case 'landscape-secondary': + orientationNumber = 4; + break; + case 'portrait-primary': + orientationNumber = 2; + break; + case 'portrait-secondary': + orientationNumber = 8; + break; + case 'unlocked': + orientationNumber = 0; + break; + default: + break; + } + Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = orientationNumber; +}; + +module.exports = screenOrientation; From 9ba47605034f63bf0810e7ed22906383a84d8c58 Mon Sep 17 00:00:00 2001 From: tokotchd Date: Fri, 7 Aug 2015 12:14:11 -0400 Subject: [PATCH 2/3] Fix Fix --- www/screenorientation.windows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/screenorientation.windows.js b/www/screenorientation.windows.js index 80edcf5..cbe0ed0 100644 --- a/www/screenorientation.windows.js +++ b/www/screenorientation.windows.js @@ -1,6 +1,6 @@ var screenOrientation = {}; -screenOrientation.lockOrientation = function (orientation) { +screenOrientation.setOrientation = function (orientation) { var orientationNumber; switch (orientation) { case 'landscape': From 3ccadfdf648e8d45032495e7178a2b5837f661fc Mon Sep 17 00:00:00 2001 From: tokotchd Date: Fri, 7 Aug 2015 12:18:11 -0400 Subject: [PATCH 3/3] Updated Readme Updated Readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 805f1d3..79cf1ec 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,10 @@ Wraps the com.blackberry.app plugin functions, auto installed as a dependancy. Windows phone does not support specification or primary and secondary orientations. If called with a specific orientation the plugin will just apply the landscape or portait orientation. +## W8.1 Notes + +Windows 8.1 Applicaitons (runtime/metro applications) will only display orientation changes if the device has some sort of accelerometer. The internal state of the "orientation" will still be kept, but the actual screen won't rotate unless the device supports it. + # Changelog ## 1.3.7