Repository: cordova-plugin-camera Updated Branches: refs/heads/master e8596fbc8 -> 0c9de56da
CB-6576 - Returns a specific error message when app has no access to library. Signed-off-by: Shazron Abdullah <[email protected]> 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/0c9de56d Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/0c9de56d Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/0c9de56d Branch: refs/heads/master Commit: 0c9de56da59cc06d1e8680afbc6c96437c9b41cd Parents: e8596fb Author: RemeR <[email protected]> Authored: Tue Apr 29 12:30:50 2014 -0300 Committer: Shazron Abdullah <[email protected]> Committed: Wed Apr 30 16:03:37 2014 -0700 ---------------------------------------------------------------------- src/ios/CDVCamera.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0c9de56d/src/ios/CDVCamera.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index 9981747..8c11e60 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -24,6 +24,7 @@ #import <Cordova/NSDictionary+Extensions.h> #import <ImageIO/CGImageProperties.h> #import <AssetsLibrary/ALAssetRepresentation.h> +#import <AssetsLibrary/AssetsLibrary.h> #import <ImageIO/CGImageSource.h> #import <ImageIO/CGImageProperties.h> #import <ImageIO/CGImageDestination.h> @@ -392,7 +393,13 @@ static NSSet* org_apache_cordova_validArrowDirections; } // popoverControllerDidDismissPopover:(id)popoverController is called if popover is cancelled - CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"]; // error callback expects string ATM + CDVPluginResult* result; + if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized) { + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"]; // error callback expects string ATM + } else { + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"has no access to assets"]; // error callback expects string ATM + } + [self.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId]; self.hasPendingOperation = NO;
