Skip to content

Commit

Permalink
Update ELCAlbumPickerController.m
Browse files Browse the repository at this point in the history
Gestion des permissions :
- Message d'erreur en Français
- Bouton ok reviens sur l'application
- Ajout du bouton "réglages"
  • Loading branch information
sbatezat authored Oct 9, 2017
1 parent 5d9e200 commit e6595a3
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/ios/ELCImagePicker/ELCAlbumPickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "ELCAlbumPickerController.h"
#import "ELCImagePickerController.h"
#import "ELCAssetTablePicker.h"
#import "ELCAssetSelectionDelegate.h"

@interface ELCAlbumPickerController ()

Expand Down Expand Up @@ -67,7 +68,7 @@ - (void)viewDidLoad
// Group Enumerator Failure Block
void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) {

UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Album Error: %@ - %@", [error localizedDescription], [error localizedRecoverySuggestion]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Autoriser %@ à accéder à vos photos", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]] message:@"L'accès a été refusé précédemment. Veuillez autoriser l'accès depuis les Réglages" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:@"Réglages", nil];
[alert show];

NSLog(@"A problem occured %@", [error description]);
Expand All @@ -82,6 +83,26 @@ - (void)viewDidLoad
});
}


// Delegate for camera permission UIAlertView
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// If Settings button (on iOS 8), open the settings app
if (buttonIndex == 1) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
if (&UIApplicationOpenSettingsURLString != NULL) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
#pragma clang diagnostic pop
}

ELCImagePickerController* imagepicker = (ELCImagePickerController*)self.parent;

[imagepicker.imagePickerDelegate elcImagePickerControllerDidCancel:nil];
}


- (void)reloadTableView
{
[self.tableView reloadData];
Expand Down Expand Up @@ -161,4 +182,3 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
}

@end

0 comments on commit e6595a3

Please sign in to comment.