Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master b16c5234d -> 20dcaf2cb


CB-10128: [iOS] Fixed how checks access authorization to camera & library. This 
closes #146


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/20dcaf2c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/20dcaf2c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/20dcaf2c

Branch: refs/heads/master
Commit: 20dcaf2cb3966dcd140385052fc3aa14605af97e
Parents: b16c523
Author: Miguel Revetria <mig...@xmartlabs.com>
Authored: Fri Dec 4 10:22:16 2015 -0300
Committer: Omar Mefire <omef...@gmail.com>
Committed: Wed Feb 24 16:10:20 2016 -0800

----------------------------------------------------------------------
 src/ios/CDVCamera.m | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/20dcaf2c/src/ios/CDVCamera.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index 850f447..1fae2e2 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -558,11 +558,14 @@ static NSString* toBase64(NSData* data) {
     
     dispatch_block_t invoke = ^ (void) {
         CDVPluginResult* result;
-        if ([ALAssetsLibrary authorizationStatus] == 
ALAuthorizationStatusAuthorized) {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR 
messageAsString:@"no image selected"];
-        } else {
+        if (picker.sourceType == UIImagePickerControllerSourceTypeCamera && 
[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] != 
ALAuthorizationStatusAuthorized) {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR 
messageAsString:@"has no access to camera"];
+        } else if (picker.sourceType != 
UIImagePickerControllerSourceTypeCamera && [ALAssetsLibrary 
authorizationStatus] != ALAuthorizationStatusAuthorized) {
             result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR 
messageAsString:@"has no access to assets"];
+        } else {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR 
messageAsString:@"no image selected"];
         }
+
         
         [weakSelf.commandDelegate sendPluginResult:result 
callbackId:cameraPicker.callbackId];
         


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to