Description
When building a custom iOS module and using UIActivity (modal window), the UIActivityController keeps rotating, even the app orientation is locked to a particular orientation, e.g Portrait.
Attached is a sample project containing the module which runs the module's example app.js
The module source can be found here:
https://github.com/viezel/TiSocial.Framework
Steps to reproduce
1. Run the example app
2. If you rotate the screen it should remain in portrait
3. click on the button "Activity View"
4. Try to rotate the screen. Despite the locked portrait orientation the modal window causes the screen to rotate.
While working on this, I noticed that - (UIViewController *)performWithActivityItems:(NSArray *)activityItems is missing a return statement. This should be fixed in the module.
Okay, so here's the sticky wicket: During device rotation, Titanium runtime consults the topmost view controller for the preferred orientation. This makes sense, as a modal can override the hidden view's orientation. As such, I'm tempted to mark this invalid, because the UI Activity's view controller is explicitly allowing the rotation by returning 26 for -[UIViewController supportedInterfaceOrientations]. So one could claim that it's the module developer's responsibility, as it's their view controller. And were the 'SLTwitterComposeViewController' subclassable or public, that's what I would suggest, but it isn't, sadly. One possible workaround would be to make a view controller that wraps and provides the right interfaceOrientation value, but that also gets difficult. However, it is one option the module developer may want to look into. So what to do? Overriding native view controller preferences is a risky proposition, one we explicitly avoid because of past issues. This especially gets hairy with parity and the like, because this WOULD be a new feature. But a native experience would allow one to do such. I hate to say it, but maybe this is something that needs punting until 3.2.0, when orientation support is limited to iOS 6+ and much of the edge cases that this would run up against are reduced.
For now, advising module developer wrap their view controller in view controller which they can control orientation. Will advise to mark this ticket as invalid (since this is expected behavior) and propose a new feature for 3.2.0 as part of the orientation issues.
Blain, Thanks for the description. Make sense its invalid (even though its a bug). Ill wait for 3.2.0 to update my module
Closing ticket as invalid with reference to the above comments.