@trustchex/react-native-sdk 1.355.1 → 1.357.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 +2 -9
- package/TrustchexSDK.podspec +5 -4
- package/android/build.gradle +6 -4
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +45 -25
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraManager.kt +168 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +871 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +245 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidationModule.kt +785 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidator.kt +419 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/opencv/OpenCVModule.kt +818 -0
- package/ios/Camera/TrustchexCameraManager.m +37 -0
- package/ios/Camera/TrustchexCameraManager.swift +125 -0
- package/ios/Camera/TrustchexCameraView.swift +1176 -0
- package/ios/MLKit/MLKitModule.m +23 -0
- package/ios/MLKit/MLKitModule.swift +250 -0
- package/ios/MRZValidation.m +39 -0
- package/ios/MRZValidation.swift +802 -0
- package/ios/MRZValidator.swift +466 -0
- package/ios/OpenCV/OpenCVModule.h +4 -0
- package/ios/OpenCV/OpenCVModule.mm +810 -0
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +2 -3
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +1 -2
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +418 -193
- package/lib/module/Screens/Static/OTPVerificationScreen.js +11 -11
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +5 -1
- package/lib/module/Screens/Static/ResultScreen.js +25 -2
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +25 -7
- package/lib/module/Shared/Components/DebugNavigationPanel.js +234 -24
- package/lib/module/Shared/Components/EIDScanner.js +99 -9
- package/lib/module/Shared/Components/FaceCamera.js +170 -179
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +2151 -771
- package/lib/module/Shared/Components/QrCodeScannerCamera.js +109 -107
- package/lib/module/Shared/Components/TrustchexCamera.js +122 -0
- package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +91 -0
- package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +2 -124
- package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +4 -4
- package/lib/module/Shared/Libs/analytics.utils.js +2 -2
- package/lib/module/Shared/Libs/debug.utils.js +132 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +6 -5
- package/lib/module/Shared/Libs/demo.utils.js +13 -3
- package/lib/module/Shared/Libs/mrz.utils.js +1 -175
- package/lib/module/Shared/Libs/native-device-info.utils.js +12 -6
- package/lib/module/Shared/Libs/tts.utils.js +40 -6
- package/lib/module/Shared/Services/AnalyticsService.js +9 -8
- package/lib/module/Shared/Types/mrzFields.js +1 -0
- package/lib/module/Translation/Resources/en.js +87 -88
- package/lib/module/Translation/Resources/tr.js +84 -85
- package/lib/module/Trustchex.js +9 -2
- package/lib/module/index.js +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +2 -2
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +18 -4
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -4
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +2 -1
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +124 -0
- package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts +11 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +2 -39
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/debug.utils.d.ts +42 -0
- package/lib/typescript/src/Shared/Libs/debug.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +0 -4
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +4 -3
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Services/AnalyticsService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +2 -2
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts +11 -0
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -0
- package/lib/typescript/src/Translation/Resources/en.d.ts +4 -5
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts +4 -5
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts +2 -0
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +4 -35
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -1
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +7 -5
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +2 -3
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +498 -216
- package/src/Screens/Static/OTPVerificationScreen.tsx +37 -31
- package/src/Screens/Static/QrCodeScanningScreen.tsx +8 -1
- package/src/Screens/Static/ResultScreen.tsx +136 -88
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +46 -13
- package/src/Shared/Components/DebugNavigationPanel.tsx +290 -34
- package/src/Shared/Components/EIDScanner.tsx +94 -16
- package/src/Shared/Components/FaceCamera.tsx +236 -203
- package/src/Shared/Components/IdentityDocumentCamera.tsx +3073 -1030
- package/src/Shared/Components/QrCodeScannerCamera.tsx +133 -127
- package/src/Shared/Components/TrustchexCamera.tsx +289 -0
- package/src/Shared/Config/camera-enhancement.config.ts +2 -2
- package/src/Shared/EIDReader/tlv/tlv.helpers.ts +96 -0
- package/src/Shared/EIDReader/tlv/tlv.utils.ts +2 -125
- package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +4 -4
- package/src/Shared/Libs/analytics.utils.ts +48 -20
- package/src/Shared/Libs/debug.utils.ts +149 -0
- package/src/Shared/Libs/deeplink.utils.ts +7 -5
- package/src/Shared/Libs/demo.utils.ts +4 -0
- package/src/Shared/Libs/http-client.ts +12 -8
- package/src/Shared/Libs/mrz.utils.ts +1 -163
- package/src/Shared/Libs/native-device-info.utils.ts +12 -6
- package/src/Shared/Libs/tts.utils.ts +48 -6
- package/src/Shared/Services/AnalyticsService.ts +69 -24
- package/src/Shared/Types/identificationInfo.ts +2 -2
- package/src/Shared/Types/mrzFields.ts +29 -0
- package/src/Translation/Resources/en.ts +90 -100
- package/src/Translation/Resources/tr.ts +89 -97
- package/src/Translation/index.ts +1 -1
- package/src/Trustchex.tsx +21 -4
- package/src/index.tsx +14 -0
- package/src/version.ts +1 -1
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +0 -301
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +0 -205
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +0 -72
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +0 -4
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +0 -303
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +0 -115
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +0 -9
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +0 -22
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +0 -188
- package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +0 -13
- package/ios/VisionCameraPlugins/Cropper/Cropper.h +0 -20
- package/ios/VisionCameraPlugins/Cropper/Cropper.mm +0 -22
- package/ios/VisionCameraPlugins/Cropper/Cropper.swift +0 -145
- package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +0 -49
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +0 -4
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +0 -22
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +0 -320
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +0 -4
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +0 -27
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +0 -144
- package/lib/module/Shared/Libs/camera.utils.js +0 -308
- package/lib/module/Shared/Libs/frame-enhancement.utils.js +0 -133
- package/lib/module/Shared/Libs/opencv.utils.js +0 -21
- package/lib/module/Shared/Libs/worklet.utils.js +0 -68
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +0 -46
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +0 -35
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -19
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +0 -26
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +0 -3
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +0 -197
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +0 -101
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +0 -60
- package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +0 -47
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +0 -42
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +0 -35
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +0 -4
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +0 -3
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +0 -56
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +0 -20
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +0 -9
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +0 -6
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +0 -20
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +0 -19
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +0 -3
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +0 -87
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +0 -25
- package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +0 -3
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +0 -9
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +0 -13
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +0 -6
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -12
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +0 -52
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +0 -62
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +0 -34
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +0 -32
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +0 -23
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +0 -9
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +0 -79
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +0 -6
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +0 -5
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +0 -67
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +0 -1
- package/src/Shared/Libs/camera.utils.ts +0 -345
- package/src/Shared/Libs/frame-enhancement.utils.ts +0 -217
- package/src/Shared/Libs/opencv.utils.ts +0 -40
- package/src/Shared/Libs/worklet.utils.ts +0 -72
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +0 -79
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +0 -46
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -60
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +0 -32
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +0 -82
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +0 -195
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +0 -135
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +0 -84
- package/src/Shared/VisionCameraPlugins/Cropper/index.ts +0 -78
- package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +0 -63
- package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +0 -44
- package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +0 -3
- package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +0 -99
- package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +0 -76
- package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +0 -18
- package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +0 -7
- package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +0 -7
- package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +0 -27
- package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +0 -21
- package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +0 -141
|
@@ -1,46 +1,60 @@
|
|
|
1
1
|
import { useIsFocused } from '@react-navigation/native';
|
|
2
2
|
import { useKeepAwake } from '../Libs/native-keep-awake.utils';
|
|
3
|
-
import
|
|
3
|
+
import { debugLog, debugWarn, debugError, logError } from '../Libs/debug.utils';
|
|
4
|
+
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
4
5
|
import {
|
|
5
6
|
StyleSheet,
|
|
6
7
|
Text,
|
|
7
8
|
View,
|
|
8
9
|
Platform,
|
|
9
10
|
Linking,
|
|
10
|
-
Dimensions,
|
|
11
11
|
ActivityIndicator,
|
|
12
12
|
NativeModules,
|
|
13
|
+
PermissionsAndroid,
|
|
14
|
+
type NativeSyntheticEvent,
|
|
13
15
|
} from 'react-native';
|
|
14
16
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
useCameraFormat,
|
|
20
|
-
runAtTargetFps,
|
|
21
|
-
useMicrophonePermission,
|
|
22
|
-
} from 'react-native-vision-camera';
|
|
23
|
-
import type { Frame } from 'react-native-vision-camera';
|
|
24
|
-
import { runAsync } from '../Libs/worklet.utils';
|
|
25
|
-
import {
|
|
26
|
-
type Face,
|
|
27
|
-
useFaceDetector,
|
|
28
|
-
} from '../VisionCameraPlugins/FaceDetector';
|
|
29
|
-
import { Worklets, useSharedValue } from 'react-native-worklets-core';
|
|
30
|
-
import { crop } from '../VisionCameraPlugins/Cropper';
|
|
31
|
-
import { isCircularRegionBright, isBlurry } from '../Libs/camera.utils';
|
|
17
|
+
TrustchexCamera,
|
|
18
|
+
type TrustchexCameraHandle,
|
|
19
|
+
type Frame,
|
|
20
|
+
} from './TrustchexCamera';
|
|
32
21
|
import { useTranslation } from 'react-i18next';
|
|
33
22
|
import StyledButton from './StyledButton';
|
|
34
23
|
import { useTheme } from '../Contexts/ThemeContext';
|
|
35
24
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
25
|
+
import { Dimensions } from 'react-native';
|
|
26
|
+
|
|
27
|
+
const { width: windowWidth, height: windowHeight } = Dimensions.get('window');
|
|
28
|
+
const { OpenCVModule } = NativeModules;
|
|
29
|
+
const MIN_BRIGHTNESS_THRESHOLD = 80;
|
|
30
|
+
const BLUR_VARIANCE_THRESHOLD = 60;
|
|
31
|
+
const REGION_BRIGHTNESS_THRESHOLD = 70;
|
|
32
|
+
|
|
33
|
+
export type Face = {
|
|
34
|
+
bounds: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
yawAngle: number;
|
|
41
|
+
pitchAngle: number;
|
|
42
|
+
rollAngle: number;
|
|
43
|
+
trackingId?: number;
|
|
44
|
+
smilingProbability: number;
|
|
45
|
+
leftEyeOpenProbability: number;
|
|
46
|
+
rightEyeOpenProbability: number;
|
|
47
|
+
};
|
|
36
48
|
|
|
37
49
|
export type FaceCameraProps = {
|
|
38
50
|
onFacesDetected: (
|
|
39
51
|
faces: Face[],
|
|
40
52
|
image: string,
|
|
41
|
-
isImageBright: boolean
|
|
53
|
+
isImageBright: boolean,
|
|
54
|
+
frameWidth: number,
|
|
55
|
+
frameHeight: number
|
|
42
56
|
) => void;
|
|
43
|
-
onCameraInitialized: (camera:
|
|
57
|
+
onCameraInitialized: (camera: TrustchexCameraHandle) => void;
|
|
44
58
|
previewRect?: {
|
|
45
59
|
minX: number;
|
|
46
60
|
minY: number;
|
|
@@ -49,12 +63,6 @@ export type FaceCameraProps = {
|
|
|
49
63
|
};
|
|
50
64
|
};
|
|
51
65
|
|
|
52
|
-
const VIDEO_WIDTH = 1280;
|
|
53
|
-
const VIDEO_HEIGHT = 720;
|
|
54
|
-
|
|
55
|
-
const windowWidth = Dimensions.get('window').width;
|
|
56
|
-
const windowHeight = Dimensions.get('window').height;
|
|
57
|
-
|
|
58
66
|
const FaceCamera = ({
|
|
59
67
|
onFacesDetected,
|
|
60
68
|
onCameraInitialized,
|
|
@@ -62,65 +70,38 @@ const FaceCamera = ({
|
|
|
62
70
|
}: FaceCameraProps) => {
|
|
63
71
|
useKeepAwake();
|
|
64
72
|
const theme = useTheme();
|
|
65
|
-
const
|
|
66
|
-
const microphonePermission = useMicrophonePermission();
|
|
73
|
+
const [hasPermission, setHasPermission] = useState(false);
|
|
67
74
|
const [permissionsRequested, setPermissionsRequested] = useState(false);
|
|
68
|
-
const cameraRef =
|
|
75
|
+
const cameraRef = useRef<TrustchexCameraHandle>(null);
|
|
69
76
|
const isFocused = useIsFocused();
|
|
70
77
|
const [isActive, setIsActive] = useState(false);
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
{
|
|
74
|
-
videoResolution: { width: VIDEO_WIDTH, height: VIDEO_HEIGHT },
|
|
75
|
-
iso: 'max',
|
|
76
|
-
photoHdr: false,
|
|
77
|
-
videoHdr: false,
|
|
78
|
-
fps: 30,
|
|
79
|
-
},
|
|
80
|
-
]);
|
|
81
|
-
const isCameraInitialized = useSharedValue(false);
|
|
82
|
-
|
|
83
|
-
const faceDetectorOptions = useMemo(
|
|
84
|
-
() => ({
|
|
85
|
-
contourMode: 'none' as const,
|
|
86
|
-
landmarkMode: 'none' as const,
|
|
87
|
-
classificationMode: 'all' as const,
|
|
88
|
-
performanceMode: 'accurate' as const,
|
|
89
|
-
trackingEnabled: false,
|
|
90
|
-
autoScale: true,
|
|
91
|
-
windowWidth: windowWidth,
|
|
92
|
-
windowHeight: windowHeight,
|
|
93
|
-
}),
|
|
94
|
-
[windowWidth, windowHeight]
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const { detectFaces } = useFaceDetector(faceDetectorOptions);
|
|
78
|
+
const isCameraInitializedRef = useRef(false);
|
|
79
|
+
const lastFrameTimeRef = useRef(0);
|
|
98
80
|
const { t } = useTranslation();
|
|
99
81
|
|
|
100
82
|
useEffect(() => {
|
|
101
83
|
const requestPermissions = async () => {
|
|
102
|
-
if (
|
|
103
|
-
await
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
84
|
+
if (Platform.OS === 'android') {
|
|
85
|
+
const granted = await PermissionsAndroid.request(
|
|
86
|
+
PermissionsAndroid.PERMISSIONS.CAMERA
|
|
87
|
+
);
|
|
88
|
+
setHasPermission(granted === PermissionsAndroid.RESULTS.GRANTED);
|
|
89
|
+
} else {
|
|
90
|
+
// iOS permissions handled by native camera
|
|
91
|
+
setHasPermission(true);
|
|
107
92
|
}
|
|
108
93
|
setPermissionsRequested(true);
|
|
109
94
|
};
|
|
110
95
|
requestPermissions();
|
|
111
|
-
}, [
|
|
112
|
-
|
|
113
|
-
const handleFaces = Worklets.createRunOnJS(
|
|
114
|
-
(faces: Face[], image: string, isBright: boolean) => {
|
|
115
|
-
if (faces.length > 0) {
|
|
116
|
-
console.log('[FaceCamera] handleFaces called - faces:', faces.length, 'bright:', isBright);
|
|
117
|
-
onFacesDetected(faces, image, isBright);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
);
|
|
96
|
+
}, []);
|
|
121
97
|
|
|
122
98
|
useEffect(() => {
|
|
123
|
-
|
|
99
|
+
debugLog('FaceCamera', 'isActive state changed:', {
|
|
100
|
+
isFocused,
|
|
101
|
+
hasPermission,
|
|
102
|
+
isActive: isFocused && hasPermission,
|
|
103
|
+
});
|
|
104
|
+
if (isFocused && hasPermission) {
|
|
124
105
|
setIsActive(true);
|
|
125
106
|
} else {
|
|
126
107
|
setIsActive(false);
|
|
@@ -129,7 +110,7 @@ const FaceCamera = ({
|
|
|
129
110
|
return () => {
|
|
130
111
|
setIsActive(false);
|
|
131
112
|
};
|
|
132
|
-
}, [
|
|
113
|
+
}, [isFocused, hasPermission]);
|
|
133
114
|
|
|
134
115
|
// Set screen brightness to maximum when camera is active
|
|
135
116
|
useEffect(() => {
|
|
@@ -142,9 +123,13 @@ const FaceCamera = ({
|
|
|
142
123
|
if (isActive) {
|
|
143
124
|
try {
|
|
144
125
|
originalBrightness = await DeviceBrightness.getBrightness();
|
|
145
|
-
await DeviceBrightness.setBrightness(1
|
|
126
|
+
await DeviceBrightness.setBrightness(1);
|
|
146
127
|
} catch (error) {
|
|
147
|
-
|
|
128
|
+
debugLog(
|
|
129
|
+
'FaceCamera',
|
|
130
|
+
'[FaceCamera] Failed to set brightness:',
|
|
131
|
+
error
|
|
132
|
+
);
|
|
148
133
|
}
|
|
149
134
|
}
|
|
150
135
|
};
|
|
@@ -153,103 +138,178 @@ const FaceCamera = ({
|
|
|
153
138
|
|
|
154
139
|
return () => {
|
|
155
140
|
if (originalBrightness >= 0) {
|
|
156
|
-
DeviceBrightness.setBrightness(originalBrightness).catch(() => {
|
|
141
|
+
DeviceBrightness.setBrightness(originalBrightness).catch(() => {});
|
|
157
142
|
}
|
|
158
143
|
};
|
|
159
144
|
}, [isActive]);
|
|
160
145
|
|
|
161
|
-
const
|
|
162
|
-
'worklet';
|
|
163
|
-
try {
|
|
164
|
-
// Calculate brightness based on the circular preview area if provided
|
|
165
|
-
// Otherwise fall back to entire frame brightness
|
|
166
|
-
let isBright = false;
|
|
167
|
-
if (previewRect) {
|
|
168
|
-
// Convert preview rect from screen coordinates to frame coordinates
|
|
169
|
-
const scaleX = frame.width / windowWidth;
|
|
170
|
-
const scaleY = frame.height / windowHeight;
|
|
171
|
-
const frameCircleRect = {
|
|
172
|
-
minX: Math.floor(previewRect.minX * scaleX),
|
|
173
|
-
minY: Math.floor(previewRect.minY * scaleY),
|
|
174
|
-
width: Math.floor(previewRect.width * scaleX),
|
|
175
|
-
height: Math.floor(previewRect.height * scaleY),
|
|
176
|
-
};
|
|
177
|
-
isBright = isCircularRegionBright(frame, frameCircleRect, 60);
|
|
178
|
-
} else {
|
|
179
|
-
// Fallback: check entire frame brightness (use legacy method)
|
|
180
|
-
const buffer = frame.toArrayBuffer();
|
|
181
|
-
const data = new Uint8Array(buffer);
|
|
182
|
-
const width = frame.width;
|
|
183
|
-
const height = frame.height;
|
|
184
|
-
let luminanceSum = 0;
|
|
185
|
-
let pixelCount = 0;
|
|
186
|
-
const centerX = Math.floor(width / 2);
|
|
187
|
-
const centerY = Math.floor(height / 2);
|
|
188
|
-
const halfSizeX = Math.floor(width / 2);
|
|
189
|
-
const halfSizeY = Math.floor(height / 2);
|
|
190
|
-
|
|
191
|
-
for (let y = centerY - halfSizeY; y < centerY + halfSizeY; y++) {
|
|
192
|
-
for (let x = centerX - halfSizeX; x < centerX + halfSizeX; x++) {
|
|
193
|
-
const index = y * width + x;
|
|
194
|
-
if (data[index] !== undefined) {
|
|
195
|
-
luminanceSum += data[index];
|
|
196
|
-
pixelCount++;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
isBright = (luminanceSum / pixelCount) > 60;
|
|
201
|
-
}
|
|
146
|
+
const isProcessingFrame = useRef(false);
|
|
202
147
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
148
|
+
const handleFrame = useCallback(
|
|
149
|
+
async (event: NativeSyntheticEvent<{ frame: Frame }>) => {
|
|
150
|
+
debugLog('FaceCamera', '*** FRAME CALLBACK INVOKED ***', {
|
|
151
|
+
isProcessing: isProcessingFrame.current,
|
|
152
|
+
timestamp: Date.now(),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
if (isProcessingFrame.current) {
|
|
156
|
+
debugLog('FaceCamera', 'Frame dropped - already processing');
|
|
206
157
|
return;
|
|
207
158
|
}
|
|
208
159
|
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
160
|
+
const now = Date.now();
|
|
161
|
+
const timeSinceLastFrame = now - lastFrameTimeRef.current;
|
|
162
|
+
// Throttle to ~6.7 FPS for face scanning (150ms interval matches Flutter SDK for responsive detection)
|
|
163
|
+
if (timeSinceLastFrame < 150) {
|
|
164
|
+
debugLog(
|
|
165
|
+
'FaceCamera',
|
|
166
|
+
`Frame dropped - throttling (${timeSinceLastFrame}ms < 150ms)`
|
|
167
|
+
);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
lastFrameTimeRef.current = now;
|
|
219
171
|
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
console.log('[FaceCamera] Faces detected:', faces.length);
|
|
224
|
-
}
|
|
225
|
-
handleFaces(faces, image.base64, isBright);
|
|
172
|
+
if (!isCameraInitializedRef.current) {
|
|
173
|
+
debugLog('FaceCamera', 'Camera not initialized yet');
|
|
174
|
+
return;
|
|
226
175
|
}
|
|
227
|
-
} catch (error) {
|
|
228
|
-
console.error('[FaceCamera] Face detection error:', error);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
176
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
'worklet';
|
|
235
|
-
if (!isCameraInitialized.value) {
|
|
177
|
+
if (!isActive) {
|
|
178
|
+
debugLog('FaceCamera', 'Camera not active');
|
|
236
179
|
return;
|
|
237
180
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
181
|
+
|
|
182
|
+
isProcessingFrame.current = true;
|
|
183
|
+
const { frame } = event.nativeEvent;
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
if (
|
|
187
|
+
!frame.width ||
|
|
188
|
+
!frame.height ||
|
|
189
|
+
frame.width <= 0 ||
|
|
190
|
+
frame.height <= 0
|
|
191
|
+
) {
|
|
192
|
+
debugLog('FaceCamera', 'Invalid frame dimensions');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const base64Image = frame.base64Image ?? '';
|
|
197
|
+
|
|
198
|
+
// Read faces directly from native ML Kit results
|
|
199
|
+
const nativeFaces = frame.faces ?? [];
|
|
200
|
+
debugLog('FaceCamera', 'Native faces:', nativeFaces.length);
|
|
201
|
+
|
|
202
|
+
// Map NativeFace to FaceCamera's Face type first
|
|
203
|
+
// ML Kit classification probabilities may be undefined if detection fails
|
|
204
|
+
// Default to 0 so comparisons don't fail with undefined
|
|
205
|
+
const faces: Face[] = nativeFaces.map((f) => ({
|
|
206
|
+
bounds: {
|
|
207
|
+
x: f.bounds.x,
|
|
208
|
+
y: f.bounds.y,
|
|
209
|
+
width: f.bounds.width,
|
|
210
|
+
height: f.bounds.height,
|
|
211
|
+
},
|
|
212
|
+
yawAngle: f.yawAngle ?? 0,
|
|
213
|
+
pitchAngle: f.pitchAngle ?? 0,
|
|
214
|
+
rollAngle: f.rollAngle ?? 0,
|
|
215
|
+
smilingProbability: f.smilingProbability ?? 0,
|
|
216
|
+
leftEyeOpenProbability: f.leftEyeOpenProbability ?? 0,
|
|
217
|
+
rightEyeOpenProbability: f.rightEyeOpenProbability ?? 0,
|
|
218
|
+
}));
|
|
219
|
+
|
|
220
|
+
// Check overall brightness - computed natively on the Y plane
|
|
221
|
+
const avgBrightness = frame.brightness ?? 128;
|
|
222
|
+
const isBright = avgBrightness >= MIN_BRIGHTNESS_THRESHOLD;
|
|
223
|
+
|
|
224
|
+
// Check brightness in the region of interest (circular preview area)
|
|
225
|
+
let isRegionBright = isBright; // Default to overall brightness
|
|
226
|
+
if (previewRect && base64Image && OpenCVModule) {
|
|
227
|
+
try {
|
|
228
|
+
// Scale preview rect from screen coordinates to frame coordinates
|
|
229
|
+
const scaleX = frame.width / windowWidth;
|
|
230
|
+
const scaleY = frame.height / windowHeight;
|
|
231
|
+
const regionMinX = Math.round(previewRect.minX * scaleX);
|
|
232
|
+
const regionMinY = Math.round(previewRect.minY * scaleY);
|
|
233
|
+
const regionWidth = Math.round(previewRect.width * scaleX);
|
|
234
|
+
const regionHeight = Math.round(previewRect.height * scaleY);
|
|
235
|
+
|
|
236
|
+
isRegionBright = await OpenCVModule.isCircularRegionBright(
|
|
237
|
+
base64Image,
|
|
238
|
+
regionMinX,
|
|
239
|
+
regionMinY,
|
|
240
|
+
regionWidth,
|
|
241
|
+
regionHeight,
|
|
242
|
+
REGION_BRIGHTNESS_THRESHOLD
|
|
243
|
+
);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
debugWarn('FaceCamera', 'Region brightness check failed:', error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Check for blur using OpenCV Laplacian variance
|
|
250
|
+
let isNotBlurry = true;
|
|
251
|
+
try {
|
|
252
|
+
if (base64Image && OpenCVModule) {
|
|
253
|
+
const isBlurryResult = await OpenCVModule.checkBlurry(
|
|
254
|
+
base64Image,
|
|
255
|
+
BLUR_VARIANCE_THRESHOLD
|
|
256
|
+
);
|
|
257
|
+
isNotBlurry = !isBlurryResult;
|
|
258
|
+
}
|
|
259
|
+
} catch (error) {
|
|
260
|
+
debugWarn('FaceCamera', 'Blur check failed:', error);
|
|
261
|
+
// If check fails, assume not blurry to continue
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Check quality but still pass detected faces
|
|
265
|
+
// Let liveness detection logic decide whether to accept poor quality frames
|
|
266
|
+
const hasGoodQuality = isRegionBright && isNotBlurry;
|
|
267
|
+
if (!hasGoodQuality) {
|
|
268
|
+
debugLog('FaceCamera', 'Frame quality insufficient:', {
|
|
269
|
+
avgBrightness,
|
|
270
|
+
isBright,
|
|
271
|
+
isRegionBright,
|
|
272
|
+
isNotBlurry,
|
|
273
|
+
faceCount: faces.length,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
debugLog(
|
|
278
|
+
'FaceCamera',
|
|
279
|
+
`Calling onFacesDetected with ${faces.length} faces`
|
|
280
|
+
);
|
|
281
|
+
// Always call onFacesDetected with detected faces
|
|
282
|
+
// isRegionBright indicates whether the region of interest has acceptable brightness
|
|
283
|
+
// This allows the UI to show warnings while still detecting faces
|
|
284
|
+
onFacesDetected(
|
|
285
|
+
faces,
|
|
286
|
+
base64Image,
|
|
287
|
+
isRegionBright,
|
|
288
|
+
frame.width,
|
|
289
|
+
frame.height
|
|
290
|
+
);
|
|
291
|
+
} catch (error: any) {
|
|
292
|
+
debugError('FaceCamera', 'Face detection error:', error);
|
|
293
|
+
} finally {
|
|
294
|
+
isProcessingFrame.current = false;
|
|
250
295
|
}
|
|
251
296
|
},
|
|
252
|
-
[
|
|
297
|
+
[isActive, previewRect, onFacesDetected]
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
const handleCameraReady = useCallback(() => {
|
|
301
|
+
debugLog('FaceCamera', 'Camera ready, initializing...');
|
|
302
|
+
isCameraInitializedRef.current = true;
|
|
303
|
+
if (cameraRef.current) {
|
|
304
|
+
onCameraInitialized(cameraRef.current);
|
|
305
|
+
}
|
|
306
|
+
}, [onCameraInitialized]);
|
|
307
|
+
|
|
308
|
+
const handleCameraError = useCallback(
|
|
309
|
+
(event: NativeSyntheticEvent<{ error: string }>) => {
|
|
310
|
+
logError('[FaceCamera] Camera error:', event.nativeEvent.error);
|
|
311
|
+
},
|
|
312
|
+
[]
|
|
253
313
|
);
|
|
254
314
|
|
|
255
315
|
if (!permissionsRequested) {
|
|
@@ -260,8 +320,7 @@ const FaceCamera = ({
|
|
|
260
320
|
);
|
|
261
321
|
}
|
|
262
322
|
|
|
263
|
-
if (!
|
|
264
|
-
// Camera permission denied by user - their choice, not actionable
|
|
323
|
+
if (!hasPermission) {
|
|
265
324
|
return (
|
|
266
325
|
<SafeAreaView style={styles.permissionContainer}>
|
|
267
326
|
<Text style={styles.permissionText}>
|
|
@@ -279,54 +338,28 @@ const FaceCamera = ({
|
|
|
279
338
|
);
|
|
280
339
|
}
|
|
281
340
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<StyledButton
|
|
290
|
-
mode="contained"
|
|
291
|
-
onPress={() => {
|
|
292
|
-
Linking.openSettings();
|
|
293
|
-
}}
|
|
294
|
-
>
|
|
295
|
-
{t('general.openSettings')}
|
|
296
|
-
</StyledButton>
|
|
297
|
-
</SafeAreaView>
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (device == null) {
|
|
302
|
-
// No camera device - device limitation, not actionable
|
|
303
|
-
return (
|
|
304
|
-
<SafeAreaView style={styles.permissionContainer}>
|
|
305
|
-
<Text style={styles.permissionText}>
|
|
306
|
-
{t('general.noCameraDetected')}
|
|
307
|
-
</Text>
|
|
308
|
-
</SafeAreaView>
|
|
309
|
-
);
|
|
310
|
-
}
|
|
341
|
+
debugLog('FaceCamera', 'Rendering TrustchexCamera with props:', {
|
|
342
|
+
isActive,
|
|
343
|
+
enableFrameProcessing: isActive,
|
|
344
|
+
enableFaceDetection: isActive,
|
|
345
|
+
includeBase64: true,
|
|
346
|
+
targetFps: 10,
|
|
347
|
+
});
|
|
311
348
|
|
|
312
349
|
return (
|
|
313
350
|
<View style={StyleSheet.absoluteFill}>
|
|
314
|
-
<
|
|
351
|
+
<TrustchexCamera
|
|
315
352
|
ref={cameraRef}
|
|
316
|
-
frameProcessor={frameProcessor}
|
|
317
353
|
style={StyleSheet.absoluteFill}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
isCameraInitialized.value = true;
|
|
328
|
-
onCameraInitialized(cameraRef.current!);
|
|
329
|
-
}}
|
|
354
|
+
cameraType="front"
|
|
355
|
+
torchEnabled={false}
|
|
356
|
+
enableFrameProcessing={isActive}
|
|
357
|
+
enableFaceDetection={isActive}
|
|
358
|
+
includeBase64={true} // Enabled to capture photos for liveness steps
|
|
359
|
+
targetFps={5}
|
|
360
|
+
onFrameAvailable={handleFrame}
|
|
361
|
+
onCameraReady={handleCameraReady}
|
|
362
|
+
onCameraError={handleCameraError}
|
|
330
363
|
/>
|
|
331
364
|
</View>
|
|
332
365
|
);
|