Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B6084200B40 for ; Fri, 1 Jul 2016 22:08:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B4885160A61; Fri, 1 Jul 2016 20:08:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D68FF160A4D for ; Fri, 1 Jul 2016 22:08:27 +0200 (CEST) Received: (qmail 12107 invoked by uid 500); 1 Jul 2016 20:08:27 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 12098 invoked by uid 99); 1 Jul 2016 20:08:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2016 20:08:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BE6C0E009D; Fri, 1 Jul 2016 20:08:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shazron@apache.org To: commits@cordova.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ios commit: CB-9371: Fix how prepare handles orientation on ios Date: Fri, 1 Jul 2016 20:08:26 +0000 (UTC) archived-at: Fri, 01 Jul 2016 20:08:28 -0000 Repository: cordova-ios Updated Branches: refs/heads/master 3d80c24a5 -> 5c3885b80 CB-9371: Fix how prepare handles orientation on ios Update unit tests. This closes #233 Signed-off-by: Shazron Abdullah Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/5c3885b8 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/5c3885b8 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/5c3885b8 Branch: refs/heads/master Commit: 5c3885b807f4c9556bf350c72400827a333f78d3 Parents: 3d80c24 Author: Connor Pearson Authored: Thu Jun 30 20:27:12 2016 -0400 Committer: Shazron Abdullah Committed: Fri Jul 1 13:07:50 2016 -0700 ---------------------------------------------------------------------- .../project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist | 2 ++ bin/templates/scripts/cordova/lib/prepare.js | 8 ++++---- tests/spec/unit/prepare.spec.js | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5c3885b8/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist ---------------------------------------------------------------------- diff --git a/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist b/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist index 2b5e1fe..30bada6 100644 --- a/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist +++ b/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist @@ -35,6 +35,8 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5c3885b8/bin/templates/scripts/cordova/lib/prepare.js ---------------------------------------------------------------------- diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js index 8bc4d60..f3d6b79 100644 --- a/bin/templates/scripts/cordova/lib/prepare.js +++ b/bin/templates/scripts/cordova/lib/prepare.js @@ -267,9 +267,9 @@ function handleOrientationSettings(platformConfig, infoPlist) { infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; break; - default: - delete infoPlist['UISupportedInterfaceOrientations']; - delete infoPlist['UISupportedInterfaceOrientations~ipad']; + case 'default': + infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; delete infoPlist['UIInterfaceOrientation']; } } @@ -471,7 +471,7 @@ function getOrientationValue(platformConfig) { var orientation = platformConfig.getPreference('orientation'); if (!orientation) { - return ORIENTATION_DEFAULT; + return ''; } orientation = orientation.toLowerCase(); http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5c3885b8/tests/spec/unit/prepare.spec.js ---------------------------------------------------------------------- diff --git a/tests/spec/unit/prepare.spec.js b/tests/spec/unit/prepare.spec.js index 8776b15..ec2a976 100644 --- a/tests/spec/unit/prepare.spec.js +++ b/tests/spec/unit/prepare.spec.js @@ -150,8 +150,8 @@ describe('prepare', function () { it('should handle default orientation', function(done) { cfg.getPreference.andReturn('default'); wrapper(updateProject(cfg, p.locations), done, function() { - expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined(); - expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toBeUndefined(); + expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); + expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined(); }); }); @@ -179,7 +179,8 @@ describe('prepare', function () { it('should handle custom orientation', function(done) { cfg.getPreference.andReturn('some-custom-orientation'); wrapper(updateProject(cfg, p.locations), done, function() { - expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined(); + expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); + expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined(); }); }); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org