Updated Branches:
  refs/heads/master c573953b7 -> d0488e3be

Fixes CB-1511 force portrait in captureAudio

Due to changes in how orientation is handled in iOS 6, needed to add 
CDVAudioNavigationController
in order to implement supportedInterfaces api.  Also had to support this api in
CDVAudioRecorderViewController.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/d0488e3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/d0488e3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/d0488e3b

Branch: refs/heads/master
Commit: d0488e3be4261ad9742afea6c60c3087e1312df8
Parents: c573953
Author: Becky Gibson <becka...@apache.org>
Authored: Fri Sep 21 17:00:29 2012 -0400
Committer: Becky Gibson <becka...@apache.org>
Committed: Fri Sep 21 17:18:51 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCapture.h |    4 ++++
 CordovaLib/Classes/CDVCapture.m |   22 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d0488e3b/CordovaLib/Classes/CDVCapture.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCapture.h b/CordovaLib/Classes/CDVCapture.h
index b4b4a2a..3ac73bd 100644
--- a/CordovaLib/Classes/CDVCapture.h
+++ b/CordovaLib/Classes/CDVCapture.h
@@ -64,6 +64,10 @@ typedef NSUInteger CDVCaptureError;
 
 @end
 
+@interface CDVAudioNavigationController : UINavigationController
+
+@end
+
 /* AudioRecorderViewController is used to create a simple view for audio 
recording.
  *  It is created from [Capture captureAudio].  It creates a very simple 
interface for
  *  recording by presenting just a record/stop button and a Done button to 
close the view.

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d0488e3b/CordovaLib/Classes/CDVCapture.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCapture.m b/CordovaLib/Classes/CDVCapture.m
index dfefa55..c90b75b 100644
--- a/CordovaLib/Classes/CDVCapture.m
+++ b/CordovaLib/Classes/CDVCapture.m
@@ -85,7 +85,8 @@
         CDVAudioRecorderViewController* audioViewController = 
[[CDVAudioRecorderViewController alloc] initWithCommand:self duration:duration 
callbackId:callbackId];
 
         // Now create a nav controller and display the view...
-        UINavigationController* navController = [[UINavigationController 
alloc] initWithRootViewController:audioViewController];
+        CDVAudioNavigationController* navController = 
[[CDVAudioNavigationController alloc] 
initWithRootViewController:audioViewController];
+
         self.inUse = YES;
 
         if ([self.viewController 
respondsToSelector:@selector(presentViewController:::)]) {
@@ -537,6 +538,16 @@
 
 @end
 
+@implementation CDVAudioNavigationController
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    // delegate to CVDAudioRecorderViewController
+    return [self.topViewController supportedInterfaceOrientations];
+}
+
+@end
+
 @implementation CDVAudioRecorderViewController
 @synthesize errorCode, callbackId, duration, captureCommand, doneButton, 
recordingView, recordButton, recordImage, stopRecordImage, timerLabel, 
avRecorder, avSession, resultString, timer, isTimed;
 
@@ -691,6 +702,15 @@
     }
 }
 
+- (NSUInteger)supportedInterfaceOrientations
+{
+    NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must 
support portrait
+    NSUInteger supported = [captureCommand.viewController 
supportedInterfaceOrientations];
+
+    orientation = orientation | (supported & 
UIInterfaceOrientationMaskPortraitUpsideDown);
+    return orientation;
+}
+
 - (void)viewDidUnload
 {
     [self setView:nil];

Reply via email to