@trustchex/react-native-sdk 1.357.1 → 1.360.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.
@@ -780,20 +780,27 @@ class TrustchexCameraView(context: ThemedReactContext) : FrameLayout(context) {
780
780
 
781
781
  @OptIn(ExperimentalGetImage::class)
782
782
  private fun applyCameraSettings() {
783
- // CameraX manages continuous autofocus automatically
784
- // We only need to set initial focus point at center
785
783
  val camera = camera ?: return
784
+ val isFrontCamera = cameraSelector == CameraSelector.DEFAULT_FRONT_CAMERA
786
785
 
787
786
  try {
788
787
  val centerPoint = previewView.meteringPointFactory.createPoint(0.5f, 0.5f)
789
- val afAction = FocusMeteringAction.Builder(
790
- centerPoint,
788
+
789
+ // Front camera: Enable AE/AF/AWB for face detection
790
+ // Back camera: Focus on center for document scanning
791
+ val flags = if (isFrontCamera) {
792
+ FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE or FocusMeteringAction.FLAG_AWB
793
+ } else {
791
794
  FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE
792
- ).build()
795
+ }
796
+
797
+ val afAction = FocusMeteringAction.Builder(centerPoint, flags)
798
+ .setAutoCancelDuration(5, java.util.concurrent.TimeUnit.SECONDS)
799
+ .build()
793
800
 
794
801
  camera.cameraControl.startFocusAndMetering(afAction)
795
802
  } catch (e: Exception) {
796
- // Silently handle - not critical
803
+ android.util.Log.w("TrustchexCamera", "Failed to apply camera settings: ${e.message}")
797
804
  }
798
805
  }
799
806
  private fun sendFrameEvent(frameData: WritableMap) {
@@ -250,25 +250,27 @@ class TrustchexCameraView: UIView {
250
250
  return AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front)
251
251
  }
252
252
 
253
- // For document/car scanning, prefer cameras with better close-range autofocus.
254
- // Wide-angle cameras can struggle with focus at close distances.
255
- // Priority: Dual Camera > Triple Camera > Wide Angle
256
-
257
- // Try dual camera first (iPhone 7 Plus and later with dual cameras)
253
+ // For document scanning, prefer wide angle camera for all models
254
+ // This provides consistent behavior across iPhone 15, 15 Pro, and other devices
255
+ if let wideAngleCamera = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) {
256
+ print("[TrustchexCamera] Selected Wide Angle camera for document scanning")
257
+ return wideAngleCamera
258
+ }
259
+
260
+ // Fallback: Try dual camera
258
261
  if let dualCamera = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: .back) {
259
- print("[TrustchexCamera] Selected Dual Camera for document scanning (better close-range focus)")
262
+ print("[TrustchexCamera] Selected Dual Camera for document scanning")
260
263
  return dualCamera
261
264
  }
262
-
263
- // Try triple camera (iPhone 11 Pro and later)
265
+
266
+ // Fallback: Try triple camera
264
267
  if let tripleCamera = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: .back) {
265
- print("[TrustchexCamera] Selected Triple Camera for document scanning (better close-range focus)")
268
+ print("[TrustchexCamera] Selected Triple Camera for document scanning")
266
269
  return tripleCamera
267
270
  }
268
-
269
- // Fall back to wide angle camera
270
- print("[TrustchexCamera] Selected Wide Angle camera for document scanning")
271
- return AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)
271
+
272
+ // Final fallback: any back camera
273
+ return AVCaptureDevice.default(for: .video)
272
274
  }
273
275
 
274
276
 
@@ -294,9 +296,6 @@ class TrustchexCameraView: UIView {
294
296
  do {
295
297
  try camera.lockForConfiguration()
296
298
 
297
- // Configure focus based on camera position
298
- // Front camera: Use continuous autofocus for liveness/face detection at arm's length
299
- // Back camera: Use close-range focus lock for document scanning
300
299
  let isFrontCamera = camera.position == .front
301
300
 
302
301
  if isFrontCamera {
@@ -304,7 +303,6 @@ class TrustchexCameraView: UIView {
304
303
  if camera.isFocusModeSupported(.continuousAutoFocus) {
305
304
  camera.focusMode = .continuousAutoFocus
306
305
 
307
- // Enable smooth autofocus for better face tracking
308
306
  if camera.isSmoothAutoFocusSupported {
309
307
  camera.isSmoothAutoFocusEnabled = true
310
308
  }
@@ -312,27 +310,24 @@ class TrustchexCameraView: UIView {
312
310
  camera.focusMode = .autoFocus
313
311
  }
314
312
  } else {
315
- // Back camera: Close-range focus for document scanning
316
- if #available(iOS 15.0, *) {
317
- if camera.isLockingFocusWithCustomLensPositionSupported {
318
- // Lock focus at close range (0.9) for document scanning
319
- camera.setFocusModeLocked(lensPosition: 0.9, completionHandler: nil)
320
- } else {
321
- // Fallback to continuous autofocus
322
- if camera.isFocusModeSupported(.continuousAutoFocus) {
323
- camera.focusMode = .continuousAutoFocus
324
- }
313
+ // Back camera: Optimized focus for document scanning across all models
314
+ if camera.isFocusModeSupported(.continuousAutoFocus) {
315
+ camera.focusMode = .continuousAutoFocus
316
+
317
+ // Set focus point to center
318
+ if camera.isFocusPointOfInterestSupported {
319
+ camera.focusPointOfInterest = CGPoint(x: 0.5, y: 0.5)
325
320
  }
326
- } else {
327
- // iOS 14 and below: Use continuous autofocus
328
- if camera.isFocusModeSupported(.continuousAutoFocus) {
329
- camera.focusMode = .continuousAutoFocus
330
321
 
331
- if camera.isSmoothAutoFocusSupported {
332
- camera.isSmoothAutoFocusEnabled = true
333
- }
334
- } else if camera.isFocusModeSupported(.autoFocus) {
335
- camera.focusMode = .autoFocus
322
+ // Disable smooth autofocus for faster, more responsive focus on documents
323
+ if camera.isSmoothAutoFocusSupported {
324
+ camera.isSmoothAutoFocusEnabled = false
325
+ }
326
+ } else if camera.isFocusModeSupported(.autoFocus) {
327
+ camera.focusMode = .autoFocus
328
+
329
+ if camera.isFocusPointOfInterestSupported {
330
+ camera.focusPointOfInterest = CGPoint(x: 0.5, y: 0.5)
336
331
  }
337
332
  }
338
333
  }
@@ -24,7 +24,7 @@ const HOLOGRAM_IMAGE_COUNT = 12;
24
24
  const HOLOGRAM_DETECTION_THRESHOLD = 1000; // Lowered for better sensitivity while still filtering noise
25
25
  const HOLOGRAM_DETECTION_RETRY_COUNT = 3; // More attempts but faster each (~1s per attempt)
26
26
  const SECOND_FACE_DETECTION_RETRY_COUNT = 10;
27
- const MIN_BRIGHTNESS_THRESHOLD = 60;
27
+ const MIN_BRIGHTNESS_THRESHOLD = 50;
28
28
  const MAX_CONSECUTIVE_QUALITY_FAILURES = 30;
29
29
  const IdentityDocumentCamera = ({
30
30
  onlyMRZScan,
@@ -1195,7 +1195,7 @@ const IdentityDocumentCamera = ({
1195
1195
  // widthPercent
1196
1196
  0.6,
1197
1197
  // heightPercent
1198
- 60 // threshold
1198
+ 50 // threshold
1199
1199
  );
1200
1200
  isNotBlurry = !isBlurry;
1201
1201
  setIsFrameBlurry(isBlurry);
@@ -2,4 +2,4 @@
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
4
  // Version is synced from package.json during build.
5
- export const SDK_VERSION = '1.357.1';
5
+ export const SDK_VERSION = '1.360.0';
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "1.357.1";
1
+ export declare const SDK_VERSION = "1.360.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustchex/react-native-sdk",
3
- "version": "1.357.1",
3
+ "version": "1.360.0",
4
4
  "description": "Trustchex mobile app react native SDK for android or ios devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -122,7 +122,7 @@ const HOLOGRAM_IMAGE_COUNT = 12;
122
122
  const HOLOGRAM_DETECTION_THRESHOLD = 1000; // Lowered for better sensitivity while still filtering noise
123
123
  const HOLOGRAM_DETECTION_RETRY_COUNT = 3; // More attempts but faster each (~1s per attempt)
124
124
  const SECOND_FACE_DETECTION_RETRY_COUNT = 10;
125
- const MIN_BRIGHTNESS_THRESHOLD = 60;
125
+ const MIN_BRIGHTNESS_THRESHOLD = 50;
126
126
  const MAX_CONSECUTIVE_QUALITY_FAILURES = 30;
127
127
 
128
128
  const IdentityDocumentCamera = ({
@@ -1912,7 +1912,7 @@ const IdentityDocumentCamera = ({
1912
1912
  0.5, // centerYPercent
1913
1913
  0.6, // widthPercent
1914
1914
  0.6, // heightPercent
1915
- 60 // threshold
1915
+ 50 // threshold
1916
1916
  );
1917
1917
  isNotBlurry = !isBlurry;
1918
1918
  setIsFrameBlurry(isBlurry);
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.357.1';
3
+ export const SDK_VERSION = '1.360.0';