Skip to content

Commit

Permalink
Merge pull request #7603 from sriks/TIMOB-20004-5_2_X
Browse files Browse the repository at this point in the history
[TIMOB-20004](5_2_X) iOS: Differences between new permission request responses
  • Loading branch information
hansemannn committed Dec 29, 2015
2 parents 09057b7 + fc22634 commit 0ee5551
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions iphone/Classes/CalendarModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ -(void) requestAuthorization:(id)args forEntityType:(EKEntityType)entityType
completion:^(BOOL granted, NSError *error){
NSDictionary* propertiesDict;
if (error == nil) {
propertiesDict = [TiUtils dictionaryWithCode:(granted ? 0 : 1) message:nil];
NSString* errorMsg = granted ? nil : @"The user has denied access to events in Calendar.";
propertiesDict = [TiUtils dictionaryWithCode:(granted ? 0 : 1) message:errorMsg];
} else {
propertiesDict = [TiUtils dictionaryWithCode:[error code]
message:[TiUtils messageFromError:error]];
propertiesDict = [TiUtils dictionaryWithCode:[error code] message:[TiUtils messageFromError:error]];
}
KrollEvent * invocationEvent = [[KrollEvent alloc] initWithCallback:callback eventObject:propertiesDict thisObject:self];
[[callback context] enqueue:invocationEvent];
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/ContactsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ -(void)requestContactsPermissions:(id)args
TiThreadPerformOnMainThread(^(){
CNContactStore *ourContactStore = [self contactStore];
[ourContactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError *error) {
NSDictionary * propertiesDict = [TiUtils dictionaryWithCode:[error code] message:[TiUtils messageFromError:error]];
NSString* errorMessage = granted ? nil : @"The user has denied access to the address book";
NSDictionary * propertiesDict = [TiUtils dictionaryWithCode:[error code] message:errorMessage];
KrollEvent * invocationEvent = [[KrollEvent alloc] initWithCallback:callback eventObject:propertiesDict thisObject:self];
[[callback context] enqueue:invocationEvent];
RELEASE_TO_NIL(invocationEvent);
Expand Down
3 changes: 1 addition & 2 deletions iphone/Classes/MediaModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,7 @@ -(void)requestCameraPermissions:(id)arg
KrollCallback * callback = arg;
TiThreadPerformOnMainThread(^(){
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted){

NSString *errorMessage = granted ? @"The user denied access to use the camera." : nil;
NSString *errorMessage = granted ? nil : @"The user denied access to use the camera.";
KrollEvent * invocationEvent = [[KrollEvent alloc] initWithCallback:callback
eventObject:[TiUtils dictionaryWithCode:(granted ? 0 : 1) message:errorMessage]
thisObject:self];
Expand Down

0 comments on commit 0ee5551

Please sign in to comment.