From d9067c5d43ea7bf8f1664002e4a25b9be6fdd50f Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 14 Mar 2017 16:22:45 -0700 Subject: [PATCH 1/8] Set VERSION to 2.0.1-dev (via coho?) --- package.json | 2 +- plugin.xml | 2 +- tests/plugin.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 75d03ba..f165524 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-screen-orientation", - "version": "2.0.0", + "version": "2.0.1-dev", "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", diff --git a/plugin.xml b/plugin.xml index 0880ec1..f81fecd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -18,7 +18,7 @@ + version="2.0.1-dev"> Screen Orientation Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10. Apache 2.0 diff --git a/tests/plugin.xml b/tests/plugin.xml index ffddc59..72b7123 100644 --- a/tests/plugin.xml +++ b/tests/plugin.xml @@ -22,7 +22,7 @@ xmlns:rim="http://www.blackberry.com/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-screen-orientation-tests" - version="2.0.0"> + version="2.0.1-dev"> Cordova Screen Orientation Plugin Tests Apache 2.0 From 5a7370a16081c68b12fbc7a311be7410696ad217 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Thu, 16 Mar 2017 16:18:44 -0700 Subject: [PATCH 2/8] Don't ignore tests, they are small enough not to be an issue, and help verify releases --- .npmignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.npmignore b/.npmignore index 62e8c49..4787202 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1 @@ demo/ -tests/ From f12721b35e8f48599d1698ead85eaf707b8532fa Mon Sep 17 00:00:00 2001 From: filmaj Date: Mon, 20 Mar 2017 12:36:50 -0700 Subject: [PATCH 3/8] CB-12588: add manual tests in cordova-plugin-test-framework style --- tests/tests.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/tests.js b/tests/tests.js index b91f81a..42b5aff 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -139,3 +139,23 @@ exports.defineAutoTests = function() { }); }); }; +exports.defineManualTests = function(contentEl, createActionButton) { + + createActionButton('Listen to orientationchange events', function() { + window.addEventListener("orientationchange", function(){ + contentEl.innerHTML += '

Orientation changed! ' + screen.orientation.type + '

'; + }); + }); + createActionButton('Unlock orientation', function() { + screen.orientation.unlock(); + contentEl.innerHTML += '

Orientation unlocked.

'; + }); + createActionButton('Lock to portrait', function() { + screen.orientation.lock('portrait'); + contentEl.innerHTML += '

Orientation locked to portrait.

'; + }); + createActionButton('Lock to landscape', function() { + screen.orientation.lock('landscape'); + contentEl.innerHTML += '

Orientation locked to landscape.

'; + }); +}; From f0c65cfee113e053433eb9c5966e0be24dee1738 Mon Sep 17 00:00:00 2001 From: Steve Gill Date: Fri, 21 Apr 2017 19:25:04 -0700 Subject: [PATCH 4/8] CB-12685: added package.json to tests folder --- tests/package.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/package.json diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 0000000..f4bfbc4 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "cordova-plugin-screen-orientation-tests", + "version": "2.0.1-dev", + "description": "", + "cordova": { + "id": "cordova-plugin-screen-orientation-tests", + "platforms": [] + }, + "keywords": [ + "ecosystem:cordova" + ], + "author": "", + "license": "Apache 2.0" +} From fce44f4942adf20cff6769f4c7b53715584f6b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20H=C3=A4usler?= Date: Fri, 3 Mar 2017 15:03:09 +0100 Subject: [PATCH 5/8] Rotate to specified orientation when locked Refactor --- src/ios/CDVOrientation.m | 21 +++++++++++++++++++-- src/windows/CDVOrientationProxy.js | 2 +- www/screenorientation.js | 17 ++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/ios/CDVOrientation.m b/src/ios/CDVOrientation.m index b38a55d..c7704e4 100644 --- a/src/ios/CDVOrientation.m +++ b/src/ios/CDVOrientation.m @@ -52,14 +52,31 @@ if([vc respondsToSelector:selector]) { ((void (*)(CDVViewController*, SEL, NSMutableArray*))objc_msgSend)(vc,selector,result); + + if ([UIDevice currentDevice] != nil){ + NSNumber *value = nil; + if(orientationMask == 8 || orientationMask == 12) { + value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]; + } else if (orientationMask == 4){ + value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; + } else if (orientationMask == 1 || orientationMask == 3) { + value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; + } else if (orientationMask == 2) { + value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown]; + } + if (value != nil) { + [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + } + } + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; } else { - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_INVALID_ACTION messageAsString:@"Error calling to set supported orientations"]; + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_INVALID_ACTION messageAsString:@"Error calling to set supported orientations"]; } [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } -@end \ No newline at end of file +@end diff --git a/src/windows/CDVOrientationProxy.js b/src/windows/CDVOrientationProxy.js index 214994a..7f36b49 100644 --- a/src/windows/CDVOrientationProxy.js +++ b/src/windows/CDVOrientationProxy.js @@ -57,6 +57,6 @@ module.exports = { } } -} +}; require("cordova/exec/proxy").add("CDVOrientation", module.exports); diff --git a/www/screenorientation.js b/www/screenorientation.js index 0bdb814..ef2eb49 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -59,7 +59,7 @@ function addScreenOrientationApi(screenObject) { screenObject.lock = function(orientation) { var promiseLock; var p = new Promise(function(resolve, reject) { - if (screenObject.nativeLock != null) { + if (screenObject.nativeLock) { promiseLock = screenObject.nativeLock(orientation); promiseLock.then(function success(res) { resolve(); @@ -70,14 +70,12 @@ function addScreenOrientationApi(screenObject) { } else { resolveOrientation(orientation, resolve, reject); } - }) + }); return p; - } - + }; screenObject.unlock = function() { screenOrientation.setOrientation('any'); }; - } function resolveOrientation(orientation, resolve, reject) { @@ -99,11 +97,11 @@ var onChangeListener = null; Object.defineProperty(screen.orientation, 'onchange', { set: function(listener) { - if (onChangeListener != null) { + if (onChangeListener) { screen.orientation.removeEventListener('change', onChangeListener); } onChangeListener = listener; - if (onChangeListener != null) { + if (onChangeListener) { screen.orientation.addEventListener('change', onChangeListener); } }, @@ -124,10 +122,11 @@ var orientationchange = function() { screen.orientation.addEventListener = function(a,b,c) { return evtTarget.addEventListener(a,b,c); -} +}; + screen.orientation.removeEventListener = function(a,b,c) { return evtTarget.removeEventListener(a,b,c); -} +}; function setOrientationProperties() { switch (window.orientation) { From eaeb4f1a73253c1947b420c14bd2fbebb1abefa4 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Mon, 24 Apr 2017 11:35:49 -0700 Subject: [PATCH 6/8] This closes #11 From 9d6894d57e13550daeb68cb02a35d221651b5687 Mon Sep 17 00:00:00 2001 From: Alexander Sorokin Date: Wed, 26 Apr 2017 16:26:56 +0300 Subject: [PATCH 7/8] CB-12622 Added Android 6.0 build badge to README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9f296c1..4764519 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ # under the License. --> -|Android 4.4|Android 5.1|iOS 9.3|iOS 10.0|Windows 10 Store| -|:-:|:-:|:-:|:-:|:-:| -|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android-4.4,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android-4.4,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android-5.1,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android-5.1,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios-9.3,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios-9.3,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios-10.0,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios-10.0,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-screen-orientation/)| +|Android 4.4|Android 5.1|Android 6.0|iOS 9.3|iOS 10.0|Windows 10 Store| +|:-:|:-:|:-:|:-:|:-:|:-:| +|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android-4.4,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android-4.4,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android-5.1,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android-5.1,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android-6.0,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android-6.0,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios-9.3,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios-9.3,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios-10.0,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios-10.0,PLUGIN=cordova-plugin-screen-orientation/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-screen-orientation)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-screen-orientation/)| # Cordova Screen Orientation Plugin From 8699159cf55bb23f6c574cf2c157426d1b6acf4d Mon Sep 17 00:00:00 2001 From: filmaj Date: Thu, 27 Apr 2017 13:11:41 -0700 Subject: [PATCH 8/8] CB-12736 Updated version and RELEASENOTES.md for release 2.0.1 (via coho) --- RELEASENOTES.md | 6 ++++++ package.json | 10 +++++----- plugin.xml | 2 +- tests/plugin.xml | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5c21e55..06b376f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -22,6 +22,12 @@ # Release Notes +### 2.0.1 (Apr 27, 2017) +* [CB-12622](https://issues.apache.org/jira/browse/CB-12622) Added **Android 6.0** build badge to `README` +* [CB-12543](https://issues.apache.org/jira/browse/CB-12543) (iOS) Rotate to specified orientation when locked +* [CB-12685](https://issues.apache.org/jira/browse/CB-12685) added `package.json` to tests folder +* [CB-12588](https://issues.apache.org/jira/browse/CB-12588) add manual tests in cordova-plugin-test-framework style + ### 2.0.0 (Mar 14, 2017) * [CB-11628](https://issues.apache.org/jira/browse/CB-11628) - w3c spec compliance https://www.w3.org/TR/screen-orientation/ diff --git a/package.json b/package.json index f165524..453caba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-screen-orientation", - "version": "2.0.1-dev", + "version": "2.0.1", "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", @@ -33,10 +33,10 @@ "jshint": "^2.9.4" }, "engines": { - "cordovaDependencies": { - "3.0.0": { - "cordova": ">100" - } + "cordovaDependencies": { + "3.0.0": { + "cordova": ">100" } } + } } diff --git a/plugin.xml b/plugin.xml index f81fecd..8517756 100644 --- a/plugin.xml +++ b/plugin.xml @@ -18,7 +18,7 @@ + version="2.0.1"> Screen Orientation Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10. Apache 2.0 diff --git a/tests/plugin.xml b/tests/plugin.xml index 72b7123..127650f 100644 --- a/tests/plugin.xml +++ b/tests/plugin.xml @@ -22,7 +22,7 @@ xmlns:rim="http://www.blackberry.com/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-screen-orientation-tests" - version="2.0.1-dev"> + version="2.0.1"> Cordova Screen Orientation Plugin Tests Apache 2.0