react-native-rectangle-doc-scanner 3.213.0 → 3.215.0

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.
@@ -40,6 +40,7 @@ class CameraController(
40
40
  private var camera: Camera? = null
41
41
  private val cameraExecutor: ExecutorService = Executors.newSingleThreadExecutor()
42
42
  private val lastFrame = AtomicReference<LastFrame?>()
43
+ private var analysisBound = false
43
44
 
44
45
  private var useFrontCamera = false
45
46
  private var detectionEnabled = true
@@ -88,6 +89,7 @@ class CameraController(
88
89
  fun stopCamera() {
89
90
  Log.d(TAG, "[CAMERAX] stopCamera called")
90
91
  cameraProvider?.unbindAll()
92
+ analysisBound = false
91
93
  }
92
94
 
93
95
  fun capturePhoto(
@@ -151,8 +153,11 @@ class CameraController(
151
153
  private fun bindCameraUseCases() {
152
154
  val provider = cameraProvider ?: return
153
155
  provider.unbindAll()
156
+ analysisBound = false
154
157
 
155
158
  val rotation = previewView.display?.rotation ?: Surface.ROTATION_0
159
+
160
+ // Build Preview
156
161
  preview = Preview.Builder()
157
162
  .setTargetAspectRatio(AspectRatio.RATIO_4_3)
158
163
  .setTargetRotation(rotation)
@@ -161,6 +166,7 @@ class CameraController(
161
166
  it.setSurfaceProvider(previewView.surfaceProvider)
162
167
  }
163
168
 
169
+ // Build ImageAnalysis
164
170
  imageAnalysis = ImageAnalysis.Builder()
165
171
  .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
166
172
  .setTargetRotation(rotation)
@@ -177,6 +183,7 @@ class CameraController(
177
183
  CameraSelector.DEFAULT_BACK_CAMERA
178
184
  }
179
185
 
186
+ // Bind both Preview and ImageAnalysis together in one call
180
187
  try {
181
188
  camera = provider.bindToLifecycle(
182
189
  lifecycleOwner,
@@ -184,9 +191,11 @@ class CameraController(
184
191
  preview,
185
192
  imageAnalysis
186
193
  )
187
- Log.d(TAG, "[CAMERAX] Camera bound successfully")
194
+ analysisBound = true
195
+ Log.d(TAG, "[CAMERAX] Camera and analysis bound successfully")
188
196
  } catch (e: Exception) {
189
- Log.e(TAG, "[CAMERAX] Failed to bind camera", e)
197
+ Log.e(TAG, "[CAMERAX] Failed to bind camera use cases", e)
198
+ analysisBound = false
190
199
  }
191
200
  }
192
201
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.213.0",
3
+ "version": "3.215.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",