You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/12/04 11:24:21 UTC

[GitHub] jcesarmobile closed pull request #321: CB-14082: (iOS) Dismiss camera popover on permission denied

jcesarmobile closed pull request #321: CB-14082: (iOS) Dismiss camera popover on permission denied
URL: https://github.com/apache/cordova-plugin-camera/pull/321
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index c71de054..e0f51ef3 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -179,6 +179,22 @@ - (void)takePicture:(CDVInvokedUrlCommand*)command
                                       cancelButtonTitle:NSLocalizedString(@"OK", nil)
                                       otherButtonTitles:settingsButton, nil] show];
                 });
+            } else if (authStatus == AVAuthorizationStatusNotDetermined){
+                [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
+                 {
+                     if(!granted)
+                     {
+                         // Dismiss the view
+                         [[self.pickerController presentingViewController] dismissViewControllerAnimated:YES completion:nil];
+
+                         CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"has no access to camera"];   // error callback expects string ATM
+
+                         [self.commandDelegate sendPluginResult:result callbackId:self.pickerController.callbackId];
+
+                         self.hasPendingOperation = NO;
+                         self.pickerController = nil;
+                     }
+                 }];
             }
         }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org