chaser-capacitor-camera-preview 7.0.6 → 7.0.7

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.
@@ -3,7 +3,7 @@ import Capacitor
3
3
  import AVFoundation
4
4
 
5
5
  @objc(CameraPreview)
6
- public class CameraPreview: CAPPlugin, CAPBridgedPlugin {
6
+ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, UIScrollViewDelegate {
7
7
 
8
8
  public let identifier = "CameraPreviewPlugin"
9
9
  public let jsName = "CameraPreview"
@@ -61,12 +61,19 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin {
61
61
 
62
62
  let adjustedHeight = self.paddingBottom != nil ? height - self.paddingBottom! : height
63
63
 
64
- if UIApplication.shared.statusBarOrientation.isLandscape {
64
+ let orientation: UIInterfaceOrientation
65
+ if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
66
+ orientation = windowScene.interfaceOrientation
67
+ } else {
68
+ orientation = .portrait
69
+ }
70
+
71
+ if orientation.isLandscape {
65
72
  previewView.frame = CGRect(x: y, y: x, width: max(adjustedHeight, width), height: min(adjustedHeight, width))
66
73
  self.cameraController.previewLayer?.frame = previewView.frame
67
74
  }
68
75
 
69
- if UIApplication.shared.statusBarOrientation.isPortrait {
76
+ if orientation.isPortrait {
70
77
  previewView.frame = CGRect(x: x, y: y, width: min(adjustedHeight, width), height: max(adjustedHeight, width))
71
78
  self.cameraController.previewLayer?.frame = previewView.frame
72
79
  }
@@ -345,7 +352,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin {
345
352
  @objc func startRecordVideo(_ call: CAPPluginCall) {
346
353
  DispatchQueue.main.async {
347
354
 
348
- let quality: Int? = call.getInt("quality", 85)
355
+ let _: Int? = call.getInt("quality", 85)
349
356
 
350
357
  self.cameraController.captureVideo { (image, error) in
351
358
 
@@ -512,7 +519,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin {
512
519
 
513
520
  }
514
521
 
515
- public func viewForZooming(in scrollView: UIScrollView) -> UIView? {
522
+ @objc public func viewForZooming(in scrollView: UIScrollView) -> UIView? {
516
523
  return self.reviewContainerView
517
524
  }
518
525
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaser-capacitor-camera-preview",
3
- "version": "7.0.6",
3
+ "version": "7.0.7",
4
4
  "description": "Camera preview",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",