@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,76 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, type ForwardedRef, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Camera as VisionCamera,
|
|
4
|
-
useFrameProcessor,
|
|
5
|
-
} from 'react-native-vision-camera';
|
|
6
|
-
import { createTextRecognitionPlugin } from './scanText';
|
|
7
|
-
import { useRunOnJS } from 'react-native-worklets-core';
|
|
8
|
-
import type {
|
|
9
|
-
CameraTypes,
|
|
10
|
-
Text,
|
|
11
|
-
Frame,
|
|
12
|
-
ReadonlyFrameProcessor,
|
|
13
|
-
TextRecognitionPlugin,
|
|
14
|
-
TranslatorPlugin,
|
|
15
|
-
TextRecognitionOptions,
|
|
16
|
-
TranslatorOptions,
|
|
17
|
-
} from './types';
|
|
18
|
-
import { createTranslatorPlugin } from './translateText';
|
|
19
|
-
|
|
20
|
-
export const Camera = forwardRef(function Camera(
|
|
21
|
-
props: CameraTypes,
|
|
22
|
-
ref: ForwardedRef<any>
|
|
23
|
-
) {
|
|
24
|
-
const { device, callback, options, mode, ...p } = props;
|
|
25
|
-
|
|
26
|
-
let plugin: TranslatorPlugin['translate'] | TextRecognitionPlugin['scanText'];
|
|
27
|
-
if (mode === 'translate') {
|
|
28
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
29
|
-
const { translate } = useTranslate(options);
|
|
30
|
-
|
|
31
|
-
plugin = translate;
|
|
32
|
-
} else {
|
|
33
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
34
|
-
const { scanText } = useTextRecognition(options);
|
|
35
|
-
plugin = scanText;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const runOnJS = useRunOnJS(
|
|
39
|
-
(data): void => {
|
|
40
|
-
callback(data);
|
|
41
|
-
},
|
|
42
|
-
[options]
|
|
43
|
-
);
|
|
44
|
-
const frameProcessor: ReadonlyFrameProcessor = useFrameProcessor(
|
|
45
|
-
(frame: Frame) => {
|
|
46
|
-
'worklet';
|
|
47
|
-
const data: Text[] | string = plugin(frame);
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
runOnJS(data);
|
|
50
|
-
},
|
|
51
|
-
[]
|
|
52
|
-
);
|
|
53
|
-
return (
|
|
54
|
-
<>
|
|
55
|
-
{!!device && (
|
|
56
|
-
<VisionCamera
|
|
57
|
-
pixelFormat="yuv"
|
|
58
|
-
ref={ref}
|
|
59
|
-
frameProcessor={frameProcessor}
|
|
60
|
-
device={device}
|
|
61
|
-
{...p}
|
|
62
|
-
/>
|
|
63
|
-
)}
|
|
64
|
-
</>
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export function useTextRecognition(
|
|
69
|
-
options?: TextRecognitionOptions
|
|
70
|
-
): TextRecognitionPlugin {
|
|
71
|
-
return useMemo(() => createTextRecognitionPlugin(options), [options]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function useTranslate(options?: TranslatorOptions): TranslatorPlugin {
|
|
75
|
-
return useMemo(() => createTranslatorPlugin(options), [options]);
|
|
76
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
import type { PhotoOptions, Text } from './types';
|
|
3
|
-
|
|
4
|
-
export async function PhotoRecognizer(options: PhotoOptions): Promise<Text> {
|
|
5
|
-
const { PhotoRecognizerModule } = NativeModules;
|
|
6
|
-
const { uri, orientation } = options;
|
|
7
|
-
if (!uri) {
|
|
8
|
-
throw Error("Can't resolve img uri");
|
|
9
|
-
}
|
|
10
|
-
if (Platform.OS === 'ios') {
|
|
11
|
-
return await PhotoRecognizerModule.process(
|
|
12
|
-
uri.replace('file://', ''),
|
|
13
|
-
orientation || 'portrait'
|
|
14
|
-
);
|
|
15
|
-
} else {
|
|
16
|
-
return await PhotoRecognizerModule.process(uri);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
|
-
import type { Languages } from './types';
|
|
3
|
-
|
|
4
|
-
export async function RemoveLanguageModel(code: Languages): Promise<boolean> {
|
|
5
|
-
const { RemoveLanguageModel: Remove } = NativeModules;
|
|
6
|
-
return await Remove.remove(code);
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { VisionCameraProxy } from 'react-native-vision-camera';
|
|
2
|
-
import type {
|
|
3
|
-
Frame,
|
|
4
|
-
TextRecognitionPlugin,
|
|
5
|
-
TextRecognitionOptions,
|
|
6
|
-
Text,
|
|
7
|
-
} from './types';
|
|
8
|
-
|
|
9
|
-
const LINKING_ERROR = `Can't load plugin scanText.Try cleaning cache or reinstall plugin.`;
|
|
10
|
-
|
|
11
|
-
export function createTextRecognitionPlugin(
|
|
12
|
-
options?: TextRecognitionOptions
|
|
13
|
-
): TextRecognitionPlugin {
|
|
14
|
-
const plugin = VisionCameraProxy.initFrameProcessorPlugin('scanText', {
|
|
15
|
-
...options,
|
|
16
|
-
});
|
|
17
|
-
if (!plugin) {
|
|
18
|
-
throw new Error(LINKING_ERROR);
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
scanText: (frame: Frame): Text[] => {
|
|
22
|
-
'worklet';
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
return plugin.call(frame) as Text[];
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Frame, TranslatorPlugin, TranslatorOptions } from './types';
|
|
2
|
-
import { VisionCameraProxy } from 'react-native-vision-camera';
|
|
3
|
-
|
|
4
|
-
const LINKING_ERROR = `Can't load plugin translate.Try cleaning cache or reinstall plugin.`;
|
|
5
|
-
|
|
6
|
-
export function createTranslatorPlugin(
|
|
7
|
-
options?: TranslatorOptions
|
|
8
|
-
): TranslatorPlugin {
|
|
9
|
-
const plugin = VisionCameraProxy.initFrameProcessorPlugin('translate', {
|
|
10
|
-
...options,
|
|
11
|
-
});
|
|
12
|
-
if (!plugin) {
|
|
13
|
-
throw new Error(LINKING_ERROR);
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
translate: (frame: Frame): string => {
|
|
17
|
-
'worklet';
|
|
18
|
-
return plugin.call(frame) as string;
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
Frame,
|
|
3
|
-
ReadonlyFrameProcessor,
|
|
4
|
-
FrameProcessorPlugin,
|
|
5
|
-
FrameInternal,
|
|
6
|
-
CameraProps,
|
|
7
|
-
CameraDevice,
|
|
8
|
-
} from 'react-native-vision-camera';
|
|
9
|
-
export type { ForwardedRef } from 'react';
|
|
10
|
-
import type { CameraProps, Frame } from 'react-native-vision-camera';
|
|
11
|
-
|
|
12
|
-
export type Languages =
|
|
13
|
-
| 'af'
|
|
14
|
-
| 'sq'
|
|
15
|
-
| 'ar'
|
|
16
|
-
| 'be'
|
|
17
|
-
| 'bn'
|
|
18
|
-
| 'bg'
|
|
19
|
-
| 'ca'
|
|
20
|
-
| 'zh'
|
|
21
|
-
| 'cs'
|
|
22
|
-
| 'da'
|
|
23
|
-
| 'nl'
|
|
24
|
-
| 'en'
|
|
25
|
-
| 'eo'
|
|
26
|
-
| 'et'
|
|
27
|
-
| 'fi'
|
|
28
|
-
| 'fr'
|
|
29
|
-
| 'gl'
|
|
30
|
-
| 'ka'
|
|
31
|
-
| 'de'
|
|
32
|
-
| 'el'
|
|
33
|
-
| 'gu'
|
|
34
|
-
| 'ht'
|
|
35
|
-
| 'he'
|
|
36
|
-
| 'hi'
|
|
37
|
-
| 'hu'
|
|
38
|
-
| 'is'
|
|
39
|
-
| 'id'
|
|
40
|
-
| 'ga'
|
|
41
|
-
| 'it'
|
|
42
|
-
| 'ja'
|
|
43
|
-
| 'kn'
|
|
44
|
-
| 'ko'
|
|
45
|
-
| 'lv'
|
|
46
|
-
| 'lt'
|
|
47
|
-
| 'mk'
|
|
48
|
-
| 'ms'
|
|
49
|
-
| 'mt'
|
|
50
|
-
| 'mr'
|
|
51
|
-
| 'no'
|
|
52
|
-
| 'fa'
|
|
53
|
-
| 'pl'
|
|
54
|
-
| 'pt'
|
|
55
|
-
| 'ro'
|
|
56
|
-
| 'ru'
|
|
57
|
-
| 'sk'
|
|
58
|
-
| 'sl'
|
|
59
|
-
| 'es'
|
|
60
|
-
| 'sw'
|
|
61
|
-
| 'tl'
|
|
62
|
-
| 'ta'
|
|
63
|
-
| 'te'
|
|
64
|
-
| 'th'
|
|
65
|
-
| 'tr'
|
|
66
|
-
| 'uk'
|
|
67
|
-
| 'ur'
|
|
68
|
-
| 'vi'
|
|
69
|
-
| 'cy';
|
|
70
|
-
|
|
71
|
-
export type TextRecognitionOptions = {
|
|
72
|
-
language: 'latin' | 'chinese' | 'devanagari' | 'japanese' | 'korean';
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type TranslatorOptions = {
|
|
76
|
-
from: Languages;
|
|
77
|
-
to: Languages;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type CameraTypes = {
|
|
81
|
-
callback: (data: string | Text[]) => void;
|
|
82
|
-
mode: 'translate' | 'recognize';
|
|
83
|
-
} & CameraProps &
|
|
84
|
-
(
|
|
85
|
-
| { mode: 'recognize'; options: TextRecognitionOptions }
|
|
86
|
-
| { mode: 'translate'; options: TranslatorOptions }
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
export type TextRecognitionPlugin = {
|
|
90
|
-
scanText: (frame: Frame) => Text[];
|
|
91
|
-
};
|
|
92
|
-
export type TranslatorPlugin = {
|
|
93
|
-
translate: (frame: Frame) => string;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export type Text = {
|
|
97
|
-
blocks: BlocksData;
|
|
98
|
-
resultText: string;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
type BlocksData = [
|
|
102
|
-
blockFrame: FrameType,
|
|
103
|
-
blockCornerPoints: CornerPointsType,
|
|
104
|
-
lines: LinesData,
|
|
105
|
-
blockLanguages: string[] | [],
|
|
106
|
-
blockText: string,
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
type CornerPointsType = [{ x: number; y: number }];
|
|
110
|
-
|
|
111
|
-
type FrameType = {
|
|
112
|
-
boundingCenterX: number;
|
|
113
|
-
boundingCenterY: number;
|
|
114
|
-
height: number;
|
|
115
|
-
width: number;
|
|
116
|
-
x: number;
|
|
117
|
-
y: number;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
type LinesData = [
|
|
121
|
-
lineCornerPoints: CornerPointsType,
|
|
122
|
-
elements: ElementsData,
|
|
123
|
-
lineFrame: FrameType,
|
|
124
|
-
lineLanguages: string[] | [],
|
|
125
|
-
lineText: string,
|
|
126
|
-
];
|
|
127
|
-
|
|
128
|
-
type ElementsData = [
|
|
129
|
-
elementCornerPoints: CornerPointsType,
|
|
130
|
-
elementFrame: FrameType,
|
|
131
|
-
elementText: string,
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
export type PhotoOptions = {
|
|
135
|
-
uri: string;
|
|
136
|
-
orientation?:
|
|
137
|
-
| 'landscapeRight'
|
|
138
|
-
| 'portrait'
|
|
139
|
-
| 'portraitUpsideDown'
|
|
140
|
-
| 'landscapeLeft';
|
|
141
|
-
};
|