@momo-kits/camerakit 0.161.2-beta.26 → 0.161.2-beta.27
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.
|
@@ -71,10 +71,6 @@ public class CameraView: UIView {
|
|
|
71
71
|
|
|
72
72
|
// This is used to delay camera setup until we have both granted permission & received default props
|
|
73
73
|
var hasCameraBeenSetup = false
|
|
74
|
-
// [CKCameraKit][perf] TEMP measurement — remove before publish. Captured when the
|
|
75
|
-
// view is constructed so we can see how long the OUTSIDE path (permission grant +
|
|
76
|
-
// first props) takes before camera.setup() is even called.
|
|
77
|
-
private let viewCreatedAt = CFAbsoluteTimeGetCurrent()
|
|
78
74
|
var hasPropBeenSetup = false {
|
|
79
75
|
didSet {
|
|
80
76
|
setupCamera()
|
|
@@ -88,8 +84,6 @@ public class CameraView: UIView {
|
|
|
88
84
|
private func setupCamera() {
|
|
89
85
|
if hasPropBeenSetup && hasPermissionBeenGranted && !hasCameraBeenSetup {
|
|
90
86
|
hasCameraBeenSetup = true
|
|
91
|
-
// [CKCameraKit][perf] TEMP measurement — remove before publish.
|
|
92
|
-
print(String(format: "[CKCameraKit][perf] view→setupCalled=%.0fms (permission+props before setup)", (CFAbsoluteTimeGetCurrent() - viewCreatedAt) * 1000))
|
|
93
87
|
#if targetEnvironment(macCatalyst)
|
|
94
88
|
// Force front camera on Mac Catalyst during initial setup
|
|
95
89
|
camera.setup(cameraType: .front, supportedBarcodeType: scanBarcode && onReadCode != nil ? supportedBarcodeType : [])
|
|
@@ -131,11 +131,8 @@ class RealCamera: NSObject, CameraProtocol, AVCaptureMetadataOutputObjectsDelega
|
|
|
131
131
|
// MARK: - Public
|
|
132
132
|
|
|
133
133
|
func setup(cameraType: CameraType, supportedBarcodeType: [CodeFormat]) {
|
|
134
|
-
// [CKCameraKit][perf] TEMP measurement — remove before publish.
|
|
135
|
-
let tCall = CFAbsoluteTimeGetCurrent()
|
|
136
134
|
sessionQueue.async { [weak self] in
|
|
137
135
|
guard let self else { return }
|
|
138
|
-
let tBlock = CFAbsoluteTimeGetCurrent()
|
|
139
136
|
|
|
140
137
|
// Idempotency guard: a RealCamera configures its session exactly once.
|
|
141
138
|
// A fresh instance is created on every mount / Fabric recycle, so this
|
|
@@ -153,7 +150,6 @@ class RealCamera: NSObject, CameraProtocol, AVCaptureMetadataOutputObjectsDelega
|
|
|
153
150
|
// calls to beginConfiguration and commitConfiguration".
|
|
154
151
|
self.setupResult = self.configureSession(cameraType: cameraType,
|
|
155
152
|
supportedBarcodeType: supportedBarcodeType)
|
|
156
|
-
let tConfigured = CFAbsoluteTimeGetCurrent()
|
|
157
153
|
|
|
158
154
|
guard self.setupResult == .success else { return }
|
|
159
155
|
|
|
@@ -171,13 +167,6 @@ class RealCamera: NSObject, CameraProtocol, AVCaptureMetadataOutputObjectsDelega
|
|
|
171
167
|
|
|
172
168
|
// Order matches the previous behaviour: start, then observe, then torch.
|
|
173
169
|
self.startSessionIfNeeded()
|
|
174
|
-
let tStarted = CFAbsoluteTimeGetCurrent()
|
|
175
|
-
// [CKCameraKit][perf] TEMP measurement — remove before publish.
|
|
176
|
-
print(String(format: "[CKCameraKit][perf] queueWait=%.0fms configure=%.0fms startRunning=%.0fms setupTotal=%.0fms",
|
|
177
|
-
(tBlock - tCall) * 1000,
|
|
178
|
-
(tConfigured - tBlock) * 1000,
|
|
179
|
-
(tStarted - tConfigured) * 1000,
|
|
180
|
-
(tStarted - tCall) * 1000))
|
|
181
170
|
self.addObservers()
|
|
182
171
|
self.update(torchMode: self.torchMode)
|
|
183
172
|
}
|