@trustchex/react-native-sdk 1.357.0 → 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.
- package/README.md +1 -3
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +13 -6
- package/ios/Camera/TrustchexCameraView.swift +31 -36
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +2 -2
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Shared/Components/IdentityDocumentCamera.tsx +2 -2
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -24,10 +24,8 @@ npm install @trustchex/react-native-sdk
|
|
|
24
24
|
### Required Dependencies
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
|
-
npm install @react-native
|
|
28
|
-
@react-navigation/native@^7.1.14 \
|
|
27
|
+
npm install @react-navigation/native@^7.1.14 \
|
|
29
28
|
@react-navigation/native-stack@^7.3.21 \
|
|
30
|
-
@react-navigation/stack@^7.4.2 \
|
|
31
29
|
lottie-react-native@^7.2.4 \
|
|
32
30
|
react-native-compressor@^1.12.0 \
|
|
33
31
|
react-native-device-info@^13.0.0 \
|
|
@@ -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
|
-
|
|
790
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
262
|
+
print("[TrustchexCamera] Selected Dual Camera for document scanning")
|
|
260
263
|
return dualCamera
|
|
261
264
|
}
|
|
262
|
-
|
|
263
|
-
// Try triple camera
|
|
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
|
|
268
|
+
print("[TrustchexCamera] Selected Triple Camera for document scanning")
|
|
266
269
|
return tripleCamera
|
|
267
270
|
}
|
|
268
|
-
|
|
269
|
-
//
|
|
270
|
-
|
|
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:
|
|
316
|
-
if
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
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 =
|
|
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
|
-
|
|
1198
|
+
50 // threshold
|
|
1199
1199
|
);
|
|
1200
1200
|
isNotBlurry = !isBlurry;
|
|
1201
1201
|
setIsFrameBlurry(isBlurry);
|
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.360.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
1915
|
+
50 // threshold
|
|
1916
1916
|
);
|
|
1917
1917
|
isNotBlurry = !isBlurry;
|
|
1918
1918
|
setIsFrameBlurry(isBlurry);
|
package/src/version.ts
CHANGED