cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject ios commit: [CB-1688] Added a camera direction option.
Date Thu, 14 Mar 2013 17:57:21 GMT
Updated Branches:
  refs/heads/master 57982de63 -> 37e9e16ad


[CB-1688] Added a camera direction option.


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

Branch: refs/heads/master
Commit: 37e9e16adaad20671a646c249f59e0dc944b1d5b
Parents: 57982de
Author: Max Woghiren <max.woghiren@gmail.com>
Authored: Wed Mar 13 14:26:23 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Mar 14 13:57:12 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCamera.m |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/37e9e16a/CordovaLib/Classes/CDVCamera.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCamera.m b/CordovaLib/Classes/CDVCamera.m
index aabe844..e2f8640 100644
--- a/CordovaLib/Classes/CDVCamera.m
+++ b/CordovaLib/Classes/CDVCamera.m
@@ -60,6 +60,8 @@ static NSSet* org_apache_cordova_validArrowDirections;
  *  7       allowsEdit
  *  8       correctOrientation
  *  9       saveToPhotoAlbum
+ *  10      popoverOptions
+ *  11      cameraDirection
  */
 - (void)takePicture:(CDVInvokedUrlCommand*)command
 {
@@ -82,6 +84,12 @@ static NSSet* org_apache_cordova_validArrowDirections;
         return;
     }
 
+    NSNumber* cameraDirection = [arguments objectAtIndex:11];
+    UIImagePickerControllerCameraDevice cameraDevice = UIImagePickerControllerCameraDeviceRear;
// default
+    if (cameraDirection != nil) {
+        cameraDevice = (UIImagePickerControllerSourceType)[cameraDirection intValue];
+    }
+
     bool allowEdit = [[arguments objectAtIndex:7] boolValue];
     NSNumber* targetWidth = [arguments objectAtIndex:3];
     NSNumber* targetHeight = [arguments objectAtIndex:4];
@@ -105,6 +113,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
 
     cameraPicker.delegate = self;
     cameraPicker.sourceType = sourceType;
+    cameraPicker.cameraDevice = cameraDevice;
     cameraPicker.allowsEditing = allowEdit; // THIS IS ALL IT TAKES FOR CROPPING - jm
     cameraPicker.callbackId = callbackId;
     cameraPicker.targetSize = targetSize;


Mime
View raw message