Skip to content

Commit

Permalink
Fix for the plugin is very slow
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaa committed Dec 24, 2019
1 parent 1fab003 commit a998ef4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ios/CDVCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,17 @@ - (void)takePicture:(CDVInvokedUrlCommand*)command

- (void)showCameraPicker:(NSString*)callbackId withOptions:(CDVPictureOptions *) pictureOptions
{
CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
self.pickerController = cameraPicker;

cameraPicker.delegate = self;
cameraPicker.callbackId = callbackId;
// we need to capture this state for memory warnings that dealloc this object
cameraPicker.webView = self.webView;

// Perform UI operations on the main thread
dispatch_async(dispatch_get_main_queue(), ^{

CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
self.pickerController = cameraPicker;

cameraPicker.delegate = self;
cameraPicker.callbackId = callbackId;
// we need to capture this state for memory warnings that dealloc this object
cameraPicker.webView = self.webView;

// If a popover is already open, close it; we only want one at a time.
if (([[self pickerController] pickerPopoverController] != nil) && [[[self pickerController] pickerPopoverController] isPopoverVisible]) {
[[[self pickerController] pickerPopoverController] dismissPopoverAnimated:YES];
Expand Down

0 comments on commit a998ef4

Please sign in to comment.