capacitor-camera-view 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,8 +115,11 @@ internal let SUPPORTED_CAMERA_DEVICE_TYPES: [AVCaptureDevice.DeviceType] = [
115
115
  }
116
116
 
117
117
  /// Stops the current capture session.
118
- public func stopSession() {
119
- guard captureSession.isRunning else { return }
118
+ public func stopSession(completion: (() -> Void)? = nil) {
119
+ guard captureSession.isRunning else {
120
+ completion?()
121
+ return
122
+ }
120
123
 
121
124
  DispatchQueue.global(qos: .userInitiated).async { [weak self] in
122
125
  self?.captureSession.stopRunning()
@@ -133,6 +136,8 @@ internal let SUPPORTED_CAMERA_DEVICE_TYPES: [AVCaptureDevice.DeviceType] = [
133
136
  blurOverlayView.removeFromSuperview()
134
137
  self.blurOverlayView = nil
135
138
  }
139
+
140
+ completion?()
136
141
  }
137
142
  }
138
143
 
@@ -95,8 +95,9 @@ public class CameraViewPlugin: CAPPlugin, CAPBridgedPlugin {
95
95
  }
96
96
 
97
97
  @objc func stop(_ call: CAPPluginCall) {
98
- implementation.stopSession()
99
- call.resolve()
98
+ implementation.stopSession {
99
+ call.resolve()
100
+ }
100
101
  }
101
102
 
102
103
  @objc func isRunning(_ call: CAPPluginCall) {
@@ -316,7 +317,7 @@ public class CameraViewPlugin: CAPPlugin, CAPBridgedPlugin {
316
317
  }
317
318
 
318
319
  let level = call.getFloat("level") ?? 1.0
319
-
320
+
320
321
  guard level >= 0.0 && level <= 1.0 else {
321
322
  call.reject("Level must be between 0.0 and 1.0")
322
323
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-camera-view",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A Capacitor plugin for embedding a live camera feed directly into your app.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",