apache/cordova-lib — pull request #128 by MMrko (2014-12-05 01:28:52+00:00)
Title: CB-8043 CB-6462 CB-6105 Refactor orientation preference support

Fixes [CB-8043](https://issues.apache.org/jira/browse/CB-8043), [CB-6462](https://issues.apache.org/jira/browse/CB-6462) and [CB-6105](https://issues.apache.org/jira/browse/CB-6105). Touches [CB-6182](https://issues.apache.org/jira/browse/CB-6182).

Adds support for the global & platform-specific orientation preference (iOS, WP8 and Firefox). Android and Amazon Fire OS already had this functionality. Additionally, platform-specific orientation preference now accepts user-defined values (e.g. `reverseLandscape` for Android or `UIInterfaceOrientationPortraitUpsideDown` for iOS). If need be I'd be happy to update the [docs](http://cordova.apache.org/docs/en/4.0.0/config_ref_index.md.html).

Both iOS and WP8 APIs allow the developer to define an initial orientation as well as a set of supported orientations. For now, the platform-specific parsers for iOS and WP8 keep it simple and don't support defining the supported orientations (see [ios_parser.js](/MMrko/cordova-lib/tree/fix-orientation-pref/cordova-lib/src/cordova/metadata/ios_parser.js#L78-L102) & [wp8_parser.js](/MMrko/cordova-lib/tree/fix-orientation-pref/cordova-lib/src/cordova/metadata/wp8_parser.js#L62-L84)). As a future improvement the orientation preference could/should offer such granularity. Meanwhile, developers can resort to a custom approach in their builds.

To help keep the code maintainable I added a [cordova-lib/src/configparser/supportedPreferences.json](/MMrko/cordova-lib/tree/fix-orientation-pref/cordova-lib/src/configparser/supportedPreferences.json) that lists the supported preferences and their values for each platform. Maintainer input would be appreciated on this since I wonder if the approach I took here is OK. Nevertheless, a central config for preferences seems necessary.

Tested on OS X Mavericks & Windows 8 running VS 2013.