capacitor-community-multilens-camerapreview 0.0.7 → 0.0.9

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.
@@ -49,7 +49,7 @@ public class CameraPreview extends Plugin implements CameraActivity.CameraPrevie
49
49
  private int previousOrientationRequest = -1;
50
50
 
51
51
  private static CameraActivity fragment;
52
- private int containerViewId = 20;
52
+ private int containerViewId = 21;
53
53
  private int zoomLevel = 0;
54
54
 
55
55
  @PluginMethod
@@ -65,7 +65,9 @@ extension CameraController {
65
65
  self.rearCamera = camera
66
66
 
67
67
  try camera.lockForConfiguration()
68
- camera.focusMode = .continuousAutoFocus
68
+ if camera.isFocusModeSupported(.continuousAutoFocus){
69
+ camera.focusMode = .continuousAutoFocus
70
+ }
69
71
  camera.unlockForConfiguration()
70
72
  }
71
73
  }
@@ -291,7 +293,9 @@ extension CameraController {
291
293
  self.rearCamera = camera
292
294
 
293
295
  try camera.lockForConfiguration()
294
- camera.focusMode = .continuousAutoFocus
296
+ if camera.isFocusModeSupported(.continuousAutoFocus){
297
+ camera.focusMode = .continuousAutoFocus
298
+ }
295
299
  camera.unlockForConfiguration()
296
300
  }
297
301
  }
@@ -235,7 +235,15 @@ public class CameraPreview: CAPPlugin {
235
235
  call.reject("failed to get supported cameras")
236
236
  }
237
237
  }
238
-
238
+ @objc func setZoom(_ call: CAPPluginCall) {
239
+ self.zoomFactor = call.getString("zoomFactor") ?? "wide"
240
+ do {
241
+ try self.cameraController.setZoom(lens: self.zoomFactor)
242
+ call.resolve()
243
+ } catch {
244
+ call.reject("failed to set zoom")
245
+ }
246
+ }
239
247
  @objc func setFlashMode(_ call: CAPPluginCall) {
240
248
  guard let flashMode = call.getString("flashMode") else {
241
249
  call.reject("failed to set flash mode. required parameter flashMode is missing")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-community-multilens-camerapreview",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "fork of capacitor community camera preview with support for switchting lenses",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",