[Chat perm] add alertView on chat add picture from library if no permission

This commit is contained in:
Brieuc Viel 2017-12-05 10:55:44 +01:00
parent 0251b6e123
commit dd789a5ed6
9 changed files with 6 additions and 1 deletions

View file

@ -20,6 +20,7 @@
#import <MobileCoreServices/UTCoreTypes.h>
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
#import "ImagePickerView.h"
#import "PhoneMainView.h"
@ -237,7 +238,11 @@ static UICompositeViewDescription *compositeDescription = nil;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
[sheet addButtonWithTitle:NSLocalizedString(@"Photo library", nil)
block:^() {
block(UIImagePickerControllerSourceTypePhotoLibrary);
if([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized ){
block(UIImagePickerControllerSourceTypePhotoLibrary);
}else{
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show];
}
}];
}
[sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];