@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.
Files changed (254) hide show
  1. package/README.md +2 -9
  2. package/TrustchexSDK.podspec +5 -4
  3. package/android/build.gradle +6 -4
  4. package/android/src/main/AndroidManifest.xml +1 -1
  5. package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +45 -25
  6. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraManager.kt +168 -0
  7. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +871 -0
  8. package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +245 -0
  9. package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidationModule.kt +785 -0
  10. package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidator.kt +419 -0
  11. package/android/src/main/java/com/trustchex/reactnativesdk/opencv/OpenCVModule.kt +818 -0
  12. package/ios/Camera/TrustchexCameraManager.m +37 -0
  13. package/ios/Camera/TrustchexCameraManager.swift +125 -0
  14. package/ios/Camera/TrustchexCameraView.swift +1176 -0
  15. package/ios/MLKit/MLKitModule.m +23 -0
  16. package/ios/MLKit/MLKitModule.swift +250 -0
  17. package/ios/MRZValidation.m +39 -0
  18. package/ios/MRZValidation.swift +802 -0
  19. package/ios/MRZValidator.swift +466 -0
  20. package/ios/OpenCV/OpenCVModule.h +4 -0
  21. package/ios/OpenCV/OpenCVModule.mm +810 -0
  22. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +2 -3
  23. package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +1 -2
  24. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +418 -193
  25. package/lib/module/Screens/Static/OTPVerificationScreen.js +11 -11
  26. package/lib/module/Screens/Static/QrCodeScanningScreen.js +5 -1
  27. package/lib/module/Screens/Static/ResultScreen.js +25 -2
  28. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +25 -7
  29. package/lib/module/Shared/Components/DebugNavigationPanel.js +234 -24
  30. package/lib/module/Shared/Components/EIDScanner.js +99 -9
  31. package/lib/module/Shared/Components/FaceCamera.js +170 -179
  32. package/lib/module/Shared/Components/IdentityDocumentCamera.js +2151 -771
  33. package/lib/module/Shared/Components/QrCodeScannerCamera.js +109 -107
  34. package/lib/module/Shared/Components/TrustchexCamera.js +122 -0
  35. package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +91 -0
  36. package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +2 -124
  37. package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +4 -4
  38. package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +4 -4
  39. package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +4 -4
  40. package/lib/module/Shared/Libs/analytics.utils.js +2 -2
  41. package/lib/module/Shared/Libs/debug.utils.js +132 -0
  42. package/lib/module/Shared/Libs/deeplink.utils.js +6 -5
  43. package/lib/module/Shared/Libs/demo.utils.js +13 -3
  44. package/lib/module/Shared/Libs/mrz.utils.js +1 -175
  45. package/lib/module/Shared/Libs/native-device-info.utils.js +12 -6
  46. package/lib/module/Shared/Libs/tts.utils.js +40 -6
  47. package/lib/module/Shared/Services/AnalyticsService.js +9 -8
  48. package/lib/module/Shared/Types/mrzFields.js +1 -0
  49. package/lib/module/Translation/Resources/en.js +87 -88
  50. package/lib/module/Translation/Resources/tr.js +84 -85
  51. package/lib/module/Trustchex.js +9 -2
  52. package/lib/module/index.js +1 -0
  53. package/lib/module/version.js +1 -1
  54. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  55. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
  56. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  57. package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
  58. package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
  59. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  60. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  61. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
  62. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +2 -2
  63. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  64. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +18 -4
  65. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  66. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -4
  67. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  68. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +2 -1
  69. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
  70. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +124 -0
  71. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -0
  72. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts +11 -0
  73. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts.map +1 -0
  74. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +2 -39
  75. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
  76. package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
  77. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts +42 -0
  78. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts.map +1 -0
  79. package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
  80. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
  81. package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
  82. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +0 -4
  83. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  84. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
  85. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +4 -3
  86. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -1
  87. package/lib/typescript/src/Shared/Services/AnalyticsService.d.ts.map +1 -1
  88. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +2 -2
  89. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
  90. package/lib/typescript/src/Shared/Types/mrzFields.d.ts +11 -0
  91. package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -0
  92. package/lib/typescript/src/Translation/Resources/en.d.ts +4 -5
  93. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  94. package/lib/typescript/src/Translation/Resources/tr.d.ts +4 -5
  95. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  96. package/lib/typescript/src/Trustchex.d.ts +2 -0
  97. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  98. package/lib/typescript/src/index.d.ts +1 -0
  99. package/lib/typescript/src/index.d.ts.map +1 -1
  100. package/lib/typescript/src/version.d.ts +1 -1
  101. package/package.json +4 -35
  102. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -1
  103. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +7 -5
  104. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +2 -3
  105. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +498 -216
  106. package/src/Screens/Static/OTPVerificationScreen.tsx +37 -31
  107. package/src/Screens/Static/QrCodeScanningScreen.tsx +8 -1
  108. package/src/Screens/Static/ResultScreen.tsx +136 -88
  109. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +46 -13
  110. package/src/Shared/Components/DebugNavigationPanel.tsx +290 -34
  111. package/src/Shared/Components/EIDScanner.tsx +94 -16
  112. package/src/Shared/Components/FaceCamera.tsx +236 -203
  113. package/src/Shared/Components/IdentityDocumentCamera.tsx +3073 -1030
  114. package/src/Shared/Components/QrCodeScannerCamera.tsx +133 -127
  115. package/src/Shared/Components/TrustchexCamera.tsx +289 -0
  116. package/src/Shared/Config/camera-enhancement.config.ts +2 -2
  117. package/src/Shared/EIDReader/tlv/tlv.helpers.ts +96 -0
  118. package/src/Shared/EIDReader/tlv/tlv.utils.ts +2 -125
  119. package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
  120. package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
  121. package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +4 -4
  122. package/src/Shared/Libs/analytics.utils.ts +48 -20
  123. package/src/Shared/Libs/debug.utils.ts +149 -0
  124. package/src/Shared/Libs/deeplink.utils.ts +7 -5
  125. package/src/Shared/Libs/demo.utils.ts +4 -0
  126. package/src/Shared/Libs/http-client.ts +12 -8
  127. package/src/Shared/Libs/mrz.utils.ts +1 -163
  128. package/src/Shared/Libs/native-device-info.utils.ts +12 -6
  129. package/src/Shared/Libs/tts.utils.ts +48 -6
  130. package/src/Shared/Services/AnalyticsService.ts +69 -24
  131. package/src/Shared/Types/identificationInfo.ts +2 -2
  132. package/src/Shared/Types/mrzFields.ts +29 -0
  133. package/src/Translation/Resources/en.ts +90 -100
  134. package/src/Translation/Resources/tr.ts +89 -97
  135. package/src/Translation/index.ts +1 -1
  136. package/src/Trustchex.tsx +21 -4
  137. package/src/index.tsx +14 -0
  138. package/src/version.ts +1 -1
  139. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +0 -301
  140. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +0 -205
  141. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +0 -72
  142. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +0 -4
  143. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +0 -303
  144. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +0 -115
  145. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +0 -9
  146. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +0 -22
  147. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +0 -188
  148. package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +0 -13
  149. package/ios/VisionCameraPlugins/Cropper/Cropper.h +0 -20
  150. package/ios/VisionCameraPlugins/Cropper/Cropper.mm +0 -22
  151. package/ios/VisionCameraPlugins/Cropper/Cropper.swift +0 -145
  152. package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +0 -49
  153. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +0 -4
  154. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +0 -22
  155. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +0 -320
  156. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +0 -4
  157. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +0 -27
  158. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +0 -144
  159. package/lib/module/Shared/Libs/camera.utils.js +0 -308
  160. package/lib/module/Shared/Libs/frame-enhancement.utils.js +0 -133
  161. package/lib/module/Shared/Libs/opencv.utils.js +0 -21
  162. package/lib/module/Shared/Libs/worklet.utils.js +0 -68
  163. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +0 -46
  164. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +0 -35
  165. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -19
  166. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +0 -26
  167. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +0 -3
  168. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +0 -197
  169. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +0 -101
  170. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +0 -60
  171. package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +0 -47
  172. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +0 -42
  173. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +0 -35
  174. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +0 -4
  175. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +0 -3
  176. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +0 -56
  177. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +0 -20
  178. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +0 -9
  179. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +0 -6
  180. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +0 -20
  181. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +0 -19
  182. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +0 -3
  183. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +0 -87
  184. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +0 -1
  185. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +0 -25
  186. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +0 -1
  187. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +0 -3
  188. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +0 -1
  189. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +0 -9
  190. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +0 -1
  191. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +0 -13
  192. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +0 -1
  193. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +0 -6
  194. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +0 -1
  195. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -12
  196. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +0 -1
  197. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +0 -3
  198. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +0 -1
  199. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +0 -52
  200. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +0 -1
  201. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +0 -62
  202. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +0 -1
  203. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +0 -34
  204. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +0 -1
  205. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +0 -32
  206. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +0 -1
  207. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +0 -23
  208. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +0 -1
  209. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +0 -9
  210. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +0 -1
  211. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +0 -3
  212. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +0 -1
  213. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +0 -3
  214. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +0 -1
  215. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +0 -79
  216. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +0 -1
  217. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +0 -6
  218. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +0 -1
  219. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +0 -3
  220. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +0 -1
  221. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +0 -3
  222. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +0 -1
  223. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +0 -5
  224. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +0 -1
  225. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +0 -3
  226. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +0 -1
  227. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +0 -3
  228. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +0 -1
  229. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +0 -67
  230. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +0 -1
  231. package/src/Shared/Libs/camera.utils.ts +0 -345
  232. package/src/Shared/Libs/frame-enhancement.utils.ts +0 -217
  233. package/src/Shared/Libs/opencv.utils.ts +0 -40
  234. package/src/Shared/Libs/worklet.utils.ts +0 -72
  235. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +0 -79
  236. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +0 -46
  237. package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -60
  238. package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +0 -32
  239. package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +0 -82
  240. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +0 -195
  241. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +0 -135
  242. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +0 -84
  243. package/src/Shared/VisionCameraPlugins/Cropper/index.ts +0 -78
  244. package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +0 -63
  245. package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +0 -44
  246. package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +0 -3
  247. package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +0 -99
  248. package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +0 -76
  249. package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +0 -18
  250. package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +0 -7
  251. package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +0 -7
  252. package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +0 -27
  253. package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +0 -21
  254. package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +0 -141
@@ -1,145 +0,0 @@
1
- import Foundation
2
- import UIKit
3
- import VisionCamera
4
-
5
- @objc(VisionCameraCropper)
6
- public class VisionCameraCropper: FrameProcessorPlugin {
7
- static public var frameTaken: UIImage?
8
-
9
- public override init(proxy: VisionCameraProxyHolder, options: [AnyHashable: Any]! = [:]) {
10
- super.init(proxy: proxy, options: options)
11
- }
12
-
13
- public override func callback(_ frame: Frame, withArguments arguments: [AnyHashable: Any]?) -> Any
14
- {
15
- var cropResult: [String: Any] = [:]
16
-
17
- guard let imageBuffer = CMSampleBufferGetImageBuffer(frame.buffer) else {
18
- print("Failed to get CVPixelBuffer!")
19
- return cropResult
20
- }
21
-
22
- let ciImage = CIImage(cvPixelBuffer: imageBuffer)
23
-
24
- guard let cgImage = CIContext().createCGImage(ciImage, from: ciImage.extent) else {
25
- print("Failed to create CGImage!")
26
- return cropResult
27
- }
28
-
29
- var image = UIImage(cgImage: cgImage)
30
- var degree: CGFloat = 0.0
31
-
32
- // Handle orientation
33
- if frame.orientation == UIImage.Orientation.left {
34
- degree = 90.0
35
- } else if frame.orientation == UIImage.Orientation.down {
36
- degree = 180.0
37
- }
38
-
39
- if degree != 0.0 {
40
- image = VisionCameraCropper.rotate(image: image, degree: degree)
41
- }
42
-
43
- // Handle crop region if provided
44
- if let cropRegion = arguments?["cropRegion"] as? [String: Double] {
45
- let imgWidth = Double(image.cgImage!.width)
46
- let imgHeight = Double(image.cgImage!.height)
47
- let left = (cropRegion["left"] ?? 0) / 100.0 * imgWidth
48
- let top = (cropRegion["top"] ?? 0) / 100.0 * imgHeight
49
- let width = (cropRegion["width"] ?? 100) / 100.0 * imgWidth
50
- let height = (cropRegion["height"] ?? 100) / 100.0 * imgHeight
51
-
52
- let cropRect = CGRect(
53
- x: left,
54
- y: top,
55
- width: width,
56
- height: height
57
- ).integral
58
-
59
- if let cropped = image.cgImage!.cropping(to: cropRect) {
60
- image = UIImage(cgImage: cropped)
61
- }
62
- }
63
-
64
- // Include base64 if requested
65
- if let includeImageBase64 = arguments?["includeImageBase64"] as? Bool, includeImageBase64 {
66
- cropResult["base64"] = VisionCameraCropper.getBase64FromImage(image)
67
- }
68
-
69
- // Save bitmap in memory if requested
70
- if let saveBitmap = arguments?["saveBitmap"] as? Bool, saveBitmap {
71
- VisionCameraCropper.frameTaken = image
72
- }
73
-
74
- // Save as file if requested
75
- if let saveAsFile = arguments?["saveAsFile"] as? Bool, saveAsFile {
76
- cropResult["path"] = saveImage(image)
77
- }
78
-
79
- return cropResult
80
- }
81
-
82
- private func saveImage(_ image: UIImage) -> String {
83
- let url = FileManager.default.temporaryDirectory
84
- .appendingPathComponent(UUID().uuidString)
85
- .appendingPathExtension("jpeg")
86
-
87
- do {
88
- try image.jpegData(compressionQuality: 1.0)?.write(to: url)
89
- return url.path
90
- } catch {
91
- print("Error saving image: \(error)")
92
- return ""
93
- }
94
- }
95
-
96
- @objc static func getBitmap() -> UIImage? {
97
- return frameTaken
98
- }
99
-
100
- // MARK: - Utility Methods
101
-
102
- public static func rotate(image: UIImage, degree: CGFloat) -> UIImage {
103
- let radians = degree / (180.0 / .pi)
104
- let rotatedSize = CGRect(origin: .zero, size: image.size)
105
- .applying(CGAffineTransform(rotationAngle: CGFloat(radians)))
106
- .integral.size
107
-
108
- UIGraphicsBeginImageContext(rotatedSize)
109
-
110
- if let context = UIGraphicsGetCurrentContext() {
111
- let origin = CGPoint(
112
- x: rotatedSize.width / 2.0,
113
- y: rotatedSize.height / 2.0)
114
- context.translateBy(x: origin.x, y: origin.y)
115
- context.rotate(by: radians)
116
- image.draw(
117
- in: CGRect(
118
- x: -origin.y, y: -origin.x,
119
- width: image.size.width, height: image.size.height))
120
- let rotatedImage = UIGraphicsGetImageFromCurrentImageContext()
121
- UIGraphicsEndImageContext()
122
-
123
- return rotatedImage ?? image
124
- }
125
-
126
- return image
127
- }
128
-
129
- public static func getBase64FromImage(_ image: UIImage) -> String {
130
- let dataTmp = image.jpegData(compressionQuality: 1.0)
131
- if let data = dataTmp {
132
- return data.base64EncodedString()
133
- }
134
- return ""
135
- }
136
-
137
- public static func convertBase64ToImage(_ imageStr: String) -> UIImage? {
138
- if let data = Data(base64Encoded: imageStr, options: .ignoreUnknownCharacters) {
139
- if let image = UIImage(data: data) {
140
- return image
141
- }
142
- }
143
- return nil
144
- }
145
- }
@@ -1,49 +0,0 @@
1
- import Foundation
2
- import UIKit
3
-
4
- public class VisionCameraCropperUtils {
5
-
6
- public static func rotate(image: UIImage, degree: CGFloat) -> UIImage {
7
- let radians = degree / (180.0 / .pi)
8
- let rotatedSize = CGRect(origin: .zero, size: image.size)
9
- .applying(CGAffineTransform(rotationAngle: CGFloat(radians)))
10
- .integral.size
11
-
12
- UIGraphicsBeginImageContext(rotatedSize)
13
-
14
- if let context = UIGraphicsGetCurrentContext() {
15
- let origin = CGPoint(
16
- x: rotatedSize.width / 2.0,
17
- y: rotatedSize.height / 2.0)
18
- context.translateBy(x: origin.x, y: origin.y)
19
- context.rotate(by: radians)
20
- image.draw(
21
- in: CGRect(
22
- x: -origin.y, y: -origin.x,
23
- width: image.size.width, height: image.size.height))
24
- let rotatedImage = UIGraphicsGetImageFromCurrentImageContext()
25
- UIGraphicsEndImageContext()
26
-
27
- return rotatedImage ?? image
28
- }
29
-
30
- return image
31
- }
32
-
33
- public static func getBase64FromImage(_ image: UIImage) -> String {
34
- let dataTmp = image.jpegData(compressionQuality: 1.0)
35
- if let data = dataTmp {
36
- return data.base64EncodedString()
37
- }
38
- return ""
39
- }
40
-
41
- public static func convertBase64ToImage(_ imageStr: String) -> UIImage? {
42
- if let data = Data(base64Encoded: imageStr, options: .ignoreUnknownCharacters) {
43
- if let image = UIImage(data: data) {
44
- return image
45
- }
46
- }
47
- return nil
48
- }
49
- }
@@ -1,4 +0,0 @@
1
- #if VISION_CAMERA_ENABLE_FRAME_PROCESSORS
2
- #import <VisionCamera/FrameProcessorPlugin.h>
3
- #import <VisionCamera/Frame.h>
4
- #endif
@@ -1,22 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <VisionCamera/FrameProcessorPlugin.h>
3
- #import <VisionCamera/FrameProcessorPluginRegistry.h>
4
- #import <VisionCamera/Frame.h>
5
-
6
- #if __has_include("TrustchexSDK/TrustchexSDK-Swift.h")
7
- #import "TrustchexSDK/TrustchexSDK-Swift.h"
8
- #else
9
- #import "TrustchexSDK-Swift.h"
10
- #endif
11
-
12
- @interface FaceDetectorFrameProcessorPlugin (FrameProcessorPluginLoader)
13
- @end
14
-
15
- @implementation FaceDetectorFrameProcessorPlugin (FrameProcessorPluginLoader)
16
- + (void)load {
17
- [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"detectFaces"
18
- withInitializer:^FrameProcessorPlugin*(VisionCameraProxyHolder* proxy, NSDictionary* options) {
19
- return [[FaceDetectorFrameProcessorPlugin alloc] initWithProxy:proxy withOptions:options];
20
- }];
21
- }
22
- @end
@@ -1,320 +0,0 @@
1
- import Foundation
2
- import VisionCamera
3
- import MLKitVision
4
- import MLKitFaceDetection
5
- import MLKitCommon
6
- import CoreML
7
- import UIKit
8
- import AVFoundation
9
- import SceneKit
10
-
11
- @objc(FaceDetectorFrameProcessorPlugin)
12
- public class FaceDetectorFrameProcessorPlugin: FrameProcessorPlugin {
13
- // detection props
14
- private var autoScale = false
15
- private var faceDetector: FaceDetector! = nil
16
- private var runLandmarks = false
17
- private var runClassifications = false
18
- private var runContours = false
19
- private var trackingEnabled = false
20
- private var windowWidth = 1.0
21
- private var windowHeight = 1.0
22
-
23
- public override init(proxy: VisionCameraProxyHolder, options: [AnyHashable: Any]! = [:]) {
24
- super.init(proxy: proxy, options: options)
25
- let config = getConfig(withArguments: options)
26
-
27
- let windowWidthParam = config?["windowWidth"] as? Double
28
- if windowWidthParam != nil && windowWidthParam != windowWidth {
29
- windowWidth = CGFloat(windowWidthParam!)
30
- }
31
-
32
- let windowHeightParam = config?["windowHeight"] as? Double
33
- if windowHeightParam != nil && windowHeightParam != windowHeight {
34
- windowHeight = CGFloat(windowHeightParam!)
35
- }
36
-
37
- // handle auto scaling
38
- autoScale = config?["autoScale"] as? Bool == true
39
-
40
- // initializes faceDetector on creation
41
- let minFaceSize = 0.15
42
- let optionsBuilder = FaceDetectorOptions()
43
- optionsBuilder.performanceMode = .fast
44
- optionsBuilder.landmarkMode = .none
45
- optionsBuilder.contourMode = .none
46
- optionsBuilder.classificationMode = .none
47
- optionsBuilder.minFaceSize = CGFloat(minFaceSize)
48
- optionsBuilder.isTrackingEnabled = false
49
-
50
- if config?["performanceMode"] as? String == "accurate" {
51
- optionsBuilder.performanceMode = .accurate
52
- }
53
-
54
- if config?["landmarkMode"] as? String == "all" {
55
- runLandmarks = true
56
- optionsBuilder.landmarkMode = .all
57
- }
58
-
59
- if config?["classificationMode"] as? String == "all" {
60
- runClassifications = true
61
- optionsBuilder.classificationMode = .all
62
- }
63
-
64
- if config?["contourMode"] as? String == "all" {
65
- runContours = true
66
- optionsBuilder.contourMode = .all
67
- }
68
-
69
- let minFaceSizeParam = config?["minFaceSize"] as? Double
70
- if minFaceSizeParam != nil && minFaceSizeParam != minFaceSize {
71
- optionsBuilder.minFaceSize = CGFloat(minFaceSizeParam!)
72
- }
73
-
74
- if config?["trackingEnabled"] as? Bool == true {
75
- trackingEnabled = true
76
- optionsBuilder.isTrackingEnabled = true
77
- }
78
-
79
- faceDetector = FaceDetector.faceDetector(options: optionsBuilder)
80
- }
81
-
82
- func getConfig(withArguments arguments: [AnyHashable: Any]!) -> [String: Any]! {
83
- if arguments.count > 0 {
84
- let config = arguments.map { dictionary in
85
- Dictionary(uniqueKeysWithValues: dictionary.map { (key, value) in
86
- (key as? String ?? "", value)
87
- })
88
- }
89
- return config
90
- }
91
- return nil
92
- }
93
-
94
- func processBoundingBox(
95
- from face: Face,
96
- sourceWidth: CGFloat,
97
- sourceHeight: CGFloat,
98
- orientation: UIImage.Orientation,
99
- scaleX: CGFloat,
100
- scaleY: CGFloat
101
- ) -> [String: Any] {
102
- let boundingBox = face.frame
103
- let width = boundingBox.width * scaleX
104
- let height = boundingBox.height * scaleY
105
- let x = boundingBox.origin.y * scaleX
106
- let y = boundingBox.origin.x * scaleY
107
-
108
- let bounds = [
109
- "width": width,
110
- "height": height,
111
- "x": (-x + sourceWidth * scaleX) - width,
112
- "y": y
113
- ]
114
-
115
- // Debug log the processed bounds
116
- print("FaceDetector iOS: Processed bounds - x: \(bounds["x"] ?? 0), y: \(bounds["y"] ?? 0), width: \(bounds["width"] ?? 0), height: \(bounds["height"] ?? 0)")
117
- print("FaceDetector iOS: Original bounds - x: \(boundingBox.origin.x), y: \(boundingBox.origin.y), width: \(boundingBox.width), height: \(boundingBox.height)")
118
- print("FaceDetector iOS: Source dimensions - width: \(sourceWidth), height: \(sourceHeight), orientation: \(orientation)")
119
-
120
- return bounds
121
- }
122
-
123
- func processLandmarks(
124
- from face: Face,
125
- scaleX: CGFloat,
126
- scaleY: CGFloat
127
- ) -> [String: [String: CGFloat?]] {
128
- let faceLandmarkTypes = [
129
- FaceLandmarkType.leftCheek,
130
- FaceLandmarkType.leftEar,
131
- FaceLandmarkType.leftEye,
132
- FaceLandmarkType.mouthBottom,
133
- FaceLandmarkType.mouthLeft,
134
- FaceLandmarkType.mouthRight,
135
- FaceLandmarkType.noseBase,
136
- FaceLandmarkType.rightCheek,
137
- FaceLandmarkType.rightEar,
138
- FaceLandmarkType.rightEye
139
- ]
140
-
141
- let faceLandmarksTypesStrings = [
142
- "LEFT_CHEEK",
143
- "LEFT_EAR",
144
- "LEFT_EYE",
145
- "MOUTH_BOTTOM",
146
- "MOUTH_LEFT",
147
- "MOUTH_RIGHT",
148
- "NOSE_BASE",
149
- "RIGHT_CHEEK",
150
- "RIGHT_EAR",
151
- "RIGHT_EYE"
152
- ]
153
-
154
- var faceLandMarksTypesMap: [String: [String: CGFloat?]] = [:]
155
- for i in 0..<faceLandmarkTypes.count {
156
- let landmark = face.landmark(ofType: faceLandmarkTypes[i])
157
- let position = [
158
- "x": (landmark?.position.x ?? 0.0) * scaleX,
159
- "y": (landmark?.position.y ?? 0.0) * scaleY
160
- ]
161
- faceLandMarksTypesMap[faceLandmarksTypesStrings[i]] = position
162
- }
163
-
164
- return faceLandMarksTypesMap
165
- }
166
-
167
- func processFaceContours(
168
- from face: Face,
169
- scaleX: CGFloat,
170
- scaleY: CGFloat
171
- ) -> [String: [[String: CGFloat]]] {
172
- let faceContoursTypes = [
173
- FaceContourType.face,
174
- FaceContourType.leftCheek,
175
- FaceContourType.leftEye,
176
- FaceContourType.leftEyebrowBottom,
177
- FaceContourType.leftEyebrowTop,
178
- FaceContourType.lowerLipBottom,
179
- FaceContourType.lowerLipTop,
180
- FaceContourType.noseBottom,
181
- FaceContourType.noseBridge,
182
- FaceContourType.rightCheek,
183
- FaceContourType.rightEye,
184
- FaceContourType.rightEyebrowBottom,
185
- FaceContourType.rightEyebrowTop,
186
- FaceContourType.upperLipBottom,
187
- FaceContourType.upperLipTop
188
- ]
189
-
190
- let faceContoursTypesStrings = [
191
- "FACE",
192
- "LEFT_CHEEK",
193
- "LEFT_EYE",
194
- "LEFT_EYEBROW_BOTTOM",
195
- "LEFT_EYEBROW_TOP",
196
- "LOWER_LIP_BOTTOM",
197
- "LOWER_LIP_TOP",
198
- "NOSE_BOTTOM",
199
- "NOSE_BRIDGE",
200
- "RIGHT_CHEEK",
201
- "RIGHT_EYE",
202
- "RIGHT_EYEBROW_BOTTOM",
203
- "RIGHT_EYEBROW_TOP",
204
- "UPPER_LIP_BOTTOM",
205
- "UPPER_LIP_TOP"
206
- ]
207
-
208
- var faceContoursTypesMap: [String: [[String: CGFloat]]] = [:]
209
- for i in 0..<faceContoursTypes.count {
210
- let contour = face.contour(ofType: faceContoursTypes[i])
211
- var pointsArray: [[String: CGFloat]] = []
212
-
213
- if let points = contour?.points {
214
- for point in points {
215
- let currentPointsMap = [
216
- "x": point.x * scaleX,
217
- "y": point.y * scaleY,
218
- ]
219
- pointsArray.append(currentPointsMap)
220
- }
221
- faceContoursTypesMap[faceContoursTypesStrings[i]] = pointsArray
222
- }
223
- }
224
-
225
- return faceContoursTypesMap
226
- }
227
-
228
- func getOrientation(orientation: UIImage.Orientation) -> UIImage.Orientation {
229
- switch orientation {
230
- case .up:
231
- // device is landscape left
232
- return .up
233
- case .left:
234
- // device is portrait
235
- return .right
236
- case .down:
237
- // device is landscape right
238
- return .down
239
- case .right:
240
- // device is upside-down
241
- return .left
242
- default:
243
- return .up
244
- }
245
- }
246
-
247
- public override func callback(_ frame: Frame, withArguments arguments: [AnyHashable: Any]?) -> Any {
248
- var result: [Any] = []
249
-
250
- do {
251
- // we need to invert sizes as frame is always -90deg rotated
252
- let width = CGFloat(frame.height)
253
- let height = CGFloat(frame.width)
254
- let orientation = getOrientation(orientation: frame.orientation)
255
- let image = VisionImage(buffer: frame.buffer)
256
- image.orientation = orientation
257
-
258
- var scaleX: CGFloat
259
- var scaleY: CGFloat
260
- if autoScale {
261
- scaleX = windowWidth / width
262
- scaleY = windowHeight / height
263
- } else {
264
- scaleX = CGFloat(1)
265
- scaleY = CGFloat(1)
266
- }
267
-
268
- let faces: [Face] = try faceDetector!.results(in: image)
269
- print("FaceDetector: Detected \(faces.count) faces")
270
-
271
- for face in faces {
272
- var map: [String: Any] = [:]
273
-
274
- if runLandmarks {
275
- map["landmarks"] = processLandmarks(
276
- from: face,
277
- scaleX: scaleX,
278
- scaleY: scaleY
279
- )
280
- }
281
-
282
- if runClassifications {
283
- map["leftEyeOpenProbability"] = face.leftEyeOpenProbability
284
- map["rightEyeOpenProbability"] = face.rightEyeOpenProbability
285
- map["smilingProbability"] = face.smilingProbability
286
- }
287
-
288
- if runContours {
289
- map["contours"] = processFaceContours(
290
- from: face,
291
- scaleX: scaleX,
292
- scaleY: scaleY
293
- )
294
- }
295
-
296
- if trackingEnabled {
297
- map["trackingId"] = face.trackingID
298
- }
299
-
300
- map["rollAngle"] = face.headEulerAngleZ
301
- map["pitchAngle"] = face.headEulerAngleX
302
- map["yawAngle"] = face.headEulerAngleY
303
- map["bounds"] = processBoundingBox(
304
- from: face,
305
- sourceWidth: width,
306
- sourceHeight: height,
307
- orientation: frame.orientation,
308
- scaleX: scaleX,
309
- scaleY: scaleY
310
- )
311
-
312
- result.append(map)
313
- }
314
- } catch let error {
315
- print("FaceDetector: Error processing face detection: \(error)")
316
- }
317
-
318
- return result
319
- }
320
- }
@@ -1,4 +0,0 @@
1
- #if VISION_CAMERA_ENABLE_FRAME_PROCESSORS
2
- #import <VisionCamera/FrameProcessorPlugin.h>
3
- #import <VisionCamera/Frame.h>
4
- #endif
@@ -1,27 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <VisionCamera/FrameProcessorPlugin.h>
3
- #import <VisionCamera/FrameProcessorPluginRegistry.h>
4
- #import <VisionCamera/Frame.h>
5
-
6
-
7
- #if __has_include("TrustchexSDK/TrustchexSDK-Swift.h")
8
- #import "TrustchexSDK/TrustchexSDK-Swift.h"
9
- #else
10
- #import "TrustchexSDK-Swift.h"
11
- #endif
12
-
13
- @interface TextRecognitionFrameProcessorPlugin (FrameProcessorPluginLoader)
14
- @end
15
-
16
- @implementation TextRecognitionFrameProcessorPlugin (FrameProcessorPluginLoader)
17
- + (void) load {
18
- [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"scanText"
19
- withInitializer:^FrameProcessorPlugin*(VisionCameraProxyHolder* proxy, NSDictionary* options) {
20
- return [[TextRecognitionFrameProcessorPlugin alloc] initWithProxy:proxy withOptions:options];
21
- }];
22
- }
23
- @end
24
-
25
-
26
-
27
-