@@ -128,25 +128,26 @@ public class CAPCameraPlugin : CAPPlugin, UIImagePickerControllerDelegate, UINav
128128
129129 AVCaptureDevice . requestAccess ( for: . video) { granted in
130130 if granted {
131- let presentationStyle = call. getString ( " presentationStyle " )
132- if presentationStyle != nil && presentationStyle == " popover " {
133- self . configurePicker ( )
134- } else {
135- self . imagePicker!. modalPresentationStyle = . fullScreen
136- }
131+ DispatchQueue . main. async {
132+ let presentationStyle = call. getString ( " presentationStyle " )
133+ if presentationStyle != nil && presentationStyle == " popover " {
134+ self . configurePicker ( )
135+ } else {
136+ self . imagePicker!. modalPresentationStyle = . fullScreen
137+ }
137138
138- self . imagePicker!. sourceType = . camera
139+ self . imagePicker!. sourceType = . camera
139140
140- if self . settings. direction. rawValue == " REAR " {
141- if UIImagePickerController . isCameraDeviceAvailable ( . rear) {
142- self . imagePicker!. cameraDevice = . rear
143- }
144- } else if self . settings. direction. rawValue == " FRONT " {
145- if UIImagePickerController . isCameraDeviceAvailable ( . front) {
146- self . imagePicker!. cameraDevice = . front
141+ if self . settings. direction. rawValue == " REAR " {
142+ if UIImagePickerController . isCameraDeviceAvailable ( . rear) {
143+ self . imagePicker!. cameraDevice = . rear
144+ }
145+ } else if self . settings. direction. rawValue == " FRONT " {
146+ if UIImagePickerController . isCameraDeviceAvailable ( . front) {
147+ self . imagePicker!. cameraDevice = . front
148+ }
147149 }
148- }
149- DispatchQueue . main. async {
150+
150151 self . bridge. viewController. present ( self . imagePicker!, animated: true , completion: nil )
151152 }
152153 } else {
0 commit comments