You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/16 19:14:49 UTC
[19/29] ios commit: updated interface to get camera working. dropped
a whole bunch of todos in terms of cleanup
updated interface to get camera working. dropped a whole bunch of todos in terms of cleanup
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/cc2f5d3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/cc2f5d3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/cc2f5d3c
Branch: refs/heads/master
Commit: cc2f5d3c449cdbd5b84818df7a38342251224ef9
Parents: c76bb61
Author: Fil Maj <ma...@gmail.com>
Authored: Sat Mar 3 01:33:32 2012 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Mar 16 10:56:49 2012 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVCamera.h | 2 +-
CordovaLib/Classes/CDVCamera.m | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/cc2f5d3c/CordovaLib/Classes/CDVCamera.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCamera.h b/CordovaLib/Classes/CDVCamera.h
index da87bc3..de58637 100644
--- a/CordovaLib/Classes/CDVCamera.h
+++ b/CordovaLib/Classes/CDVCamera.h
@@ -79,7 +79,7 @@ typedef NSUInteger CDVMediaType;
* options:
* quality: integer between 1 and 100
*/
-- (void) getPicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+- (void) takePicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void) postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url;
- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/cc2f5d3c/CordovaLib/Classes/CDVCamera.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCamera.m b/CordovaLib/Classes/CDVCamera.m
index 675db33..7fa7e60 100644
--- a/CordovaLib/Classes/CDVCamera.m
+++ b/CordovaLib/Classes/CDVCamera.m
@@ -32,11 +32,11 @@
(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
}
-- (void) getPicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+- (void) takePicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
NSString* callbackId = [arguments objectAtIndex:0];
- NSString* sourceTypeString = [options valueForKey:@"sourceType"];
+ NSString* sourceTypeString = [arguments objectAtIndex:3];
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; // default
if (sourceTypeString != nil)
{
@@ -50,9 +50,10 @@
[self writeJavascript:[result toErrorCallbackString:callbackId]];
} else {
- bool allowEdit = [[options valueForKey:@"allowEdit"] boolValue];
- NSNumber* targetWidth = [options valueForKey:@"targetWidth"];
- NSNumber* targetHeight = [options valueForKey:@"targetHeight"];
+ // TODO: re-enable this?
+ // bool allowEdit = [[options valueForKey:@"allowEdit"] boolValue];
+ NSNumber* targetWidth = [arguments objectAtIndex:4];
+ NSNumber* targetHeight = [arguments objectAtIndex:5];
NSNumber* mediaValue = [options valueForKey:@"mediaType"];
CDVMediaType mediaType = (mediaValue) ? [mediaValue intValue] : MediaTypePicture;
@@ -69,15 +70,17 @@
self.pickerController.delegate = self;
self.pickerController.sourceType = sourceType;
- self.pickerController.allowsEditing = allowEdit; // THIS IS ALL IT TAKES FOR CROPPING - jm
+ //self.pickerController.allowsEditing = allowEdit; // THIS IS ALL IT TAKES FOR CROPPING - jm
self.pickerController.callbackId = callbackId;
self.pickerController.targetSize = targetSize;
+ // TODO: wtf?
self.pickerController.correctOrientation = [[options valueForKey:@"correctOrientation"] boolValue];
self.pickerController.saveToPhotoAlbum = [[options valueForKey:@"saveToPhotoAlbum"] boolValue];
- self.pickerController.encodingType = [[options valueForKey:@"encodingType"] intValue] || EncodingTypeJPEG;
- self.pickerController.quality = [options integerValueForKey:@"quality" defaultValue:100 withRange:NSMakeRange(0, 100)];
- self.pickerController.returnType = (CDVDestinationType)[options integerValueForKey:@"destinationType" defaultValue:1 withRange:NSMakeRange(0, 2)];
+ self.pickerController.encodingType = [[arguments objectAtIndex:6] intValue] || EncodingTypeJPEG;
+
+ self.pickerController.quality = [[arguments objectAtIndex:1] intValue] || 50;
+ self.pickerController.returnType = (CDVDestinationType)[[arguments objectAtIndex:2] intValue] || DestinationTypeFileUri;
if (sourceType == UIImagePickerControllerSourceTypeCamera) {
// we only allow taking pictures (no video) in this api