[
https://issues.apache.org/jira/browse/CB-8043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14257321#comment-14257321
]
ASF GitHub Bot commented on CB-8043:
------------------------------------
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/128#discussion_r22227969
--- Diff: cordova-lib/src/configparser/ConfigParser.js ---
@@ -219,6 +258,47 @@ ConfigParser.prototype = {
},
/**
+ * Finds the value of the orientation <preference>.
+ *
+ * @param {String} [platform] Platform name
+ * @return {String} Global/platform-specific orientation
(or undefined if both are undefined)
+ */
+ getOrientation: function (platform) {
+
+ var globalOrientation = this.getGlobalPreference('orientation');
+ var platformOrientation = null;
+ var platformSupportedOrientations = null;
+
+ // Check if the value of the global orientation preference is
invalid
+ if (globalOrientation &&
!_.contains(PREFERENCE_ORIENTATION_VALUES, globalOrientation)) {
+ events.emit( 'warn', [ 'Unknown value for global orientation
preference:', globalOrientation ].join(' ') );
+ globalOrientation = undefined;
+ }
+
+ if (!platform) {
+ return globalOrientation;
+ }
+
+ platformSupportedOrientations =
supportedPreferences.orientation[platform];
+
+ if (!platformSupportedOrientations) {
+ throw new CordovaError([ 'No supported orientations defined
for platform', platform ].join (' '));
+ }
+
+ platformOrientation = this.getPlatformPreference('orientation',
platform);
+
+ // Check if the value of the platform-specific orientation
preference is invalid
+ if (platformOrientation &&
!_.contains(platformSupportedOrientations, platformOrientation)) {
--- End diff --
Would this mean that "portrait" is not a valid value for this preference on
iOS? I think we'd want to check that it's in platformSupportedOrientations *or*
PREFERENCE_ORIENTATION_VALUES
> Orientation preference's value set to anything but "landscape" or "portrait"
> doesn't work.
> ------------------------------------------------------------------------------------------
>
> Key: CB-8043
> URL: https://issues.apache.org/jira/browse/CB-8043
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Android
> Reporter: Rémi Couturier
>
> cordova-cli: 4.1.2
> cordova-android: 3.6.4
> mac: osx yosemite
> In config.xml, setting the orientation preference's value to anything but
> "landscape" or "portrait" doesn't work. Complete list of possible value:
> http://developer.android.com/guide/topics/manifest/activity-element.html#screen
> For example when setting the value to "userLandscape" and building the app
> (cordova build android), I'm getting this message: "Unknown value for
> orientation preference: userLandscape".
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]