You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by nikhilkh <gi...@git.apache.org> on 2015/04/02 00:10:56 UTC

[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

GitHub user nikhilkh opened a pull request:

    https://github.com/apache/cordova-docs/pull/276

    Document iOS specific callback for orientaion

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-docs iOS-Orientation

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-docs/pull/276.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #276
    
----
commit 15bb184a6f9aa7b937ab1aff47601d2420a62398
Author: Nikhil Khandelwal <ni...@microsoft.com>
Date:   2015-04-01T20:08:13Z

    Document iOS specific callback for orientaion

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-100075104
  
    That JS function shouldRotateToOrientation will not be supported in cordova-ios 4.0.x.
    This is because of the pluggable webview support. The CDVWebViewEngine interface calls for an async call to JavaScript now (WKWebView's function to call into JS is async).
    
    Because this call is async, the supportedOrientations selector that is called by the CDVViewController synchronously, can't use the async function above.
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-8783 Document iOS specific callback ...

Posted by msct <gi...@git.apache.org>.
Github user msct commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-104879485
  
    I'll offer my two cents.  Yes, ambiguous and technically correct, and that's why `default` should have probably always been the device default.  But these are the semantics which describe the intent and goal of Cordova as a whole....
    
    I don't use Cordova for device defaults.  We use Cordova for a familiar development pattern and a consistent experience across all devices.  Having a root-level orientation preference which allows for unrestricted orientation accomplishes that.
    
    As @shazron suggested, I am very much in favor of an **all**, or **any** value.  It's one thing to change an already well-documented config.xml *naming peculiarity*, but it's another thing to remove it outright and force code changes. Lots of love guys.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88660515
  
    This callback is *required* even if you do not want programmatic control. By default, the webview will not cause a rotation as the iOS code expects a callback to be defined and if none is defined - it will not support both landscape and portrait orientations. https://github.com/apache/cordova-ios/blob/ed54ddf2cc6e2b746a406e15e99f549846cd171b/CordovaLib/Classes/CDVViewController.m#L555


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88664145
  
    The fallback if you do not provide shouldRotateToOrientation is to evaluate based on what is specified in the plist.
    The plist values come from config.xml preferences.
    This covers all cases.
    https://issues.apache.org/jira/browse/CB-6462



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88674908
  
    config.xml does not support plist values to be set to landscape & portrait: https://github.com/apache/cordova-lib/blob/8de97feba2fa883298eb9c99be0c425c73960f1a/cordova-lib/src/cordova/metadata/ios_parser.js#L84 
    
    'default' allows both portrait & landscape mode - only after implementing the callback. I could perhaps re-word this as follows:
    
    For iOS, orientation can be programmatically controlled by defining a javascript callback on window:
    ```
        /** 
        * @param {Number} degree - UIInterfaceOrientationPortrait: 0, UIInterfaceOrientationLandscapeRight: 90, UIInterfaceOrientationLandscapeLeft: -90, UIInterfaceOrientationPortraitUpsideDown: 180
        * @returns {Boolean} Indicating if rotation should be allowed.
        */
        function shouldRotateToOrientation(degrees) {
             return true;
        }
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-100076679
  
    @nikhilkh can you edit the title to have a prefix of CB-8783 to enable auto JIRA tracking.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by mmrko <gi...@git.apache.org>.
Github user mmrko commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88833458
  
    > Actually, that is a bug. If 'default' is specified in config.xml, it should produce plist values to support both landscape and portrait.
    
    I think this is more about the semantics of `default`. IMO the `default` orientation translates to: _let the platform decide how to handle the orientation, that is, fall back to whatever is the platform's default behaviour by removing the corresponding orientation and supported orientation entries from the platform's manifest._
    
    This approach of course has, as @nikhilkh pointed out, the downside that one can not explicitly set the orientation to support both portrait and landscape via `config.xml`.
    
    Thus, to add flexibility and to address the inherent confusion around orientation `default` I'd suggest adding support for `supported-orientations` preference to `config.xml` &mdash; something that apache/cordova-lib#128 would've also benefited from. This would allow to work around the aforementioned iOS issue like so:
    
    ```js
    <preference name="orientation" value="default" />
    
    <platform name="ios">
        <preference name="supported-orientations" value="portrait, landscape" />
    </platform>
    ```
    
    If this is something you feel would make sense I'd be happy to create a PR for the changes over at [apache/cordova-lib](https://github.com/apache/cordova-lib).
    
    Ping @agrieve 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-8783 Document iOS specific callback ...

Posted by brericks <gi...@git.apache.org>.
Github user brericks commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-125025165
  
    oops, my bad. Thanks for the clarification


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-docs/pull/276


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88679255
  
    Thanks, @purplecabbage, Made the update to the docs commit and created a JIRA to track the bug: https://issues.apache.org/jira/browse/CB-8783. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88654567
  
    Not entirely correct.
    If you want to programmatically decide at runtime whether or not support an orientation, you need to 
    a) define support for multiple orientations (<preference name="Orientation" value="default" />)
    b) provide the window.shouldRotateToOrientation method and return true if you want to rotate to the new orientation.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-8783 Document iOS specific callback ...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-124972224
  
    No, it only has been reverted for all platforms. You can add it under the iOS platform and it should work. It is already released in the latest cordova-cli, see: http://cordova.apache.org/docs/en/5.1.1/config_ref_index.md.html#The%20config.xml%20File



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-8783 Document iOS specific callback ...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-106066558
  
    By silent consensus -- I'll just add the "all" option for iOS and document it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-88676211
  
    Actually, that is a bug.  If 'default' is specified in config.xml, it should produce plist values to support both landscape and portrait. Please file an issue.
    That wording is definitely better :)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: Document iOS specific callback for orie...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-100076514
  
    I'm not in favour of adding yet another preference. 
    
    If we look at the Apple docs: 
    https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW10
    
    Setting no values, implicitly sets the orientation to Portrait. Thus "default" === "portrait" here. I'm not sure this is really useful for users, especially if they don't know what "default" is (but that's a matter of documentation). Of course this varies by platform.
    
    I would leave default as implemented by @mmrko -- since it is technically correct -- but add a new preference "all" which is unambiguously clear.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-8783 Document iOS specific callback ...

Posted by brericks <gi...@git.apache.org>.
Github user brericks commented on the pull request:

    https://github.com/apache/cordova-docs/pull/276#issuecomment-124891890
  
    @shazron Looks like you reverted the "all" option. (a05f448b48dd7634696fcf2ece91e0b978348be9) Was hoping to see this land in Cordova 5.1.1.  Are there plans to re-introduce this change?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org