You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/01/02 13:41:13 UTC

[jira] [Commented] (CB-8043) Orientation preference's value set to anything but "landscape" or "portrait" doesn't work.

    [ https://issues.apache.org/jira/browse/CB-8043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14262867#comment-14262867 ] 

ASF GitHub Bot commented on CB-8043:
------------------------------------

Github user MMrko commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/128#discussion_r22409503
  
    --- 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 --
    
    Yep, that would've been a better approach. In the end supportedOrientations.json seemed to be useful only for validating user input so I omitted this check for platform-specific support altogether.


> 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: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org