CB-6576 - Returns a specific error message when app has no access to library.

Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
RemeR 2014-04-29 12:30:50 -03:00 committed by Shazron Abdullah
parent e8596fbc8e
commit 0c9de56da5

View File

@ -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;