From 10faf268d91edfb271135fc3c5a22294f36fa768 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 7 Dec 2017 10:03:21 +0100 Subject: [PATCH] [Chat] fix permission for camera and photos + build version updated --- Classes/ImagePickerView.m | 12 ++++++++---- linphone-Info.plist | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index cacd57211..584f4088a 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -229,8 +229,12 @@ static UICompositeViewDescription *compositeDescription = nil; [sheet addButtonWithTitle:NSLocalizedString(@"Camera", nil) block:^() { if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusAuthorized ){ - block(UIImagePickerControllerSourceTypeCamera); - }else{ + if([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusDenied ){ + block(UIImagePickerControllerSourceTypeCamera); + }else{ + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Photo's permission", nil) message:NSLocalizedString(@"Photo not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + } + }else { [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; } }]; @@ -238,10 +242,10 @@ static UICompositeViewDescription *compositeDescription = nil; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { [sheet addButtonWithTitle:NSLocalizedString(@"Photo library", nil) block:^() { - if([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized ){ + if([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusDenied ){ 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]; + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Photo's permission", nil) message:NSLocalizedString(@"Photo not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; } }]; } diff --git a/linphone-Info.plist b/linphone-Info.plist index 53b0d6bde..67db86bf4 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -53,7 +53,7 @@ CFBundleVersion - 9 + 10 ITSAppUsesNonExemptEncryption ITSEncryptionExportComplianceCode @@ -68,6 +68,8 @@ Make calls with your friends NSMicrophoneUsageDescription Use microphone to make audio calls + NSPhotoLibraryAddUsageDescription + Add photo you shoot by yourself NSPhotoLibraryUsageDescription Share photos with your friends and customize avatars NSVoIPUsageDescription