@ha_tecno/live-id-sdk 1.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (429) hide show
  1. package/android/build.gradle +4 -0
  2. package/lib/commonjs/components/{WaitingForResult → CameraConfigInfo}/index.js +9 -11
  3. package/lib/commonjs/components/CameraConfigInfo/index.js.map +1 -0
  4. package/lib/commonjs/components/CameraConfigInfo/styles.js +20 -0
  5. package/lib/commonjs/components/CameraConfigInfo/styles.js.map +1 -0
  6. package/lib/commonjs/components/CaptureButton/index.js +88 -0
  7. package/lib/commonjs/components/CaptureButton/index.js.map +1 -0
  8. package/lib/commonjs/components/CaptureButton/styles.js +22 -0
  9. package/lib/commonjs/components/CaptureButton/styles.js.map +1 -0
  10. package/lib/commonjs/components/Gabarito/index.js +2 -2
  11. package/lib/commonjs/components/Gabarito/index.js.map +1 -1
  12. package/lib/commonjs/components/Gabarito/styles.js +10 -11
  13. package/lib/commonjs/components/Gabarito/styles.js.map +1 -1
  14. package/lib/commonjs/components/HelpRegister/index.js +51 -0
  15. package/lib/commonjs/components/HelpRegister/index.js.map +1 -0
  16. package/lib/commonjs/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/styles.js +17 -20
  17. package/lib/commonjs/components/HelpRegister/styles.js.map +1 -0
  18. package/lib/commonjs/components/Toast/Toast.js +12 -12
  19. package/lib/commonjs/components/Toast/Toast.js.map +1 -1
  20. package/lib/commonjs/components/deviceNotFound/deviceNotFound.js +27 -0
  21. package/lib/commonjs/components/deviceNotFound/deviceNotFound.js.map +1 -0
  22. package/lib/commonjs/components/deviceNotFound/styles.js +36 -0
  23. package/lib/commonjs/components/deviceNotFound/styles.js.map +1 -0
  24. package/lib/commonjs/components/icon/icon.js +22 -0
  25. package/lib/commonjs/components/icon/icon.js.map +1 -0
  26. package/lib/commonjs/components/index.js +56 -0
  27. package/lib/commonjs/components/index.js.map +1 -0
  28. package/lib/commonjs/components/modalMessage/modalMessage.js +63 -0
  29. package/lib/commonjs/components/modalMessage/modalMessage.js.map +1 -0
  30. package/lib/commonjs/components/modalMessage/styles.js +51 -0
  31. package/lib/commonjs/components/modalMessage/styles.js.map +1 -0
  32. package/lib/commonjs/components/recordButton/recordButton.js +83 -0
  33. package/lib/commonjs/components/recordButton/recordButton.js.map +1 -0
  34. package/lib/commonjs/components/recordButton/styles.js +21 -0
  35. package/lib/commonjs/components/recordButton/styles.js.map +1 -0
  36. package/lib/commonjs/index.js +9 -11
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/screens/CadastroScreen/CadastroScreen.js +29 -29
  39. package/lib/commonjs/screens/CadastroScreen/CadastroScreen.js.map +1 -1
  40. package/lib/commonjs/screens/FingerAuth/FingerAuth.js +128 -0
  41. package/lib/commonjs/screens/FingerAuth/FingerAuth.js.map +1 -0
  42. package/lib/commonjs/screens/FingerAuth/styles.js +35 -0
  43. package/lib/commonjs/screens/FingerAuth/styles.js.map +1 -0
  44. package/lib/commonjs/screens/FingerRegister/index.js +138 -0
  45. package/lib/commonjs/screens/FingerRegister/index.js.map +1 -0
  46. package/lib/commonjs/screens/FingerRegister/styles.js +35 -0
  47. package/lib/commonjs/screens/FingerRegister/styles.js.map +1 -0
  48. package/lib/commonjs/screens/LifeCertificate/index.js +145 -0
  49. package/lib/commonjs/screens/LifeCertificate/index.js.map +1 -0
  50. package/lib/commonjs/screens/LifeCertificate/styles.js +27 -0
  51. package/lib/commonjs/screens/LifeCertificate/styles.js.map +1 -0
  52. package/lib/commonjs/screens/index.js +28 -0
  53. package/lib/commonjs/screens/index.js.map +1 -0
  54. package/lib/commonjs/services/index.js +35 -101
  55. package/lib/commonjs/services/index.js.map +1 -1
  56. package/lib/commonjs/services/services.js +134 -0
  57. package/lib/commonjs/services/services.js.map +1 -0
  58. package/lib/commonjs/services/types.js +2 -0
  59. package/lib/commonjs/{types/screen.js.map → services/types.js.map} +1 -1
  60. package/lib/commonjs/store/createSelectors.js +16 -0
  61. package/lib/commonjs/store/createSelectors.js.map +1 -0
  62. package/lib/commonjs/store/modules/fingerAuth/index.js +19 -0
  63. package/lib/commonjs/store/modules/fingerAuth/index.js.map +1 -0
  64. package/lib/commonjs/store/modules/fingerAuth/selectors.js +13 -0
  65. package/lib/commonjs/store/modules/fingerAuth/selectors.js.map +1 -0
  66. package/lib/commonjs/store/modules/fingerAuth/slice.js +92 -0
  67. package/lib/commonjs/store/modules/fingerAuth/slice.js.map +1 -0
  68. package/lib/commonjs/store/modules/fingerAuth/type.js +2 -0
  69. package/lib/commonjs/store/modules/fingerAuth/type.js.map +1 -0
  70. package/lib/commonjs/store/modules/fingerRegister/index.js +19 -0
  71. package/lib/commonjs/store/modules/fingerRegister/index.js.map +1 -0
  72. package/lib/commonjs/store/modules/fingerRegister/selectors.js +13 -0
  73. package/lib/commonjs/store/modules/fingerRegister/selectors.js.map +1 -0
  74. package/lib/commonjs/store/modules/fingerRegister/slice.js +101 -0
  75. package/lib/commonjs/store/modules/fingerRegister/slice.js.map +1 -0
  76. package/lib/commonjs/store/modules/fingerRegister/types.js +2 -0
  77. package/lib/commonjs/store/modules/fingerRegister/types.js.map +1 -0
  78. package/lib/commonjs/store/modules/lifeCertificate/index.js +19 -0
  79. package/lib/commonjs/store/modules/lifeCertificate/index.js.map +1 -0
  80. package/lib/commonjs/store/modules/lifeCertificate/selectors.js +13 -0
  81. package/lib/commonjs/store/modules/lifeCertificate/selectors.js.map +1 -0
  82. package/lib/commonjs/store/modules/lifeCertificate/slice.js +101 -0
  83. package/lib/commonjs/store/modules/lifeCertificate/slice.js.map +1 -0
  84. package/lib/commonjs/store/modules/lifeCertificate/types.js +6 -0
  85. package/lib/commonjs/store/modules/lifeCertificate/types.js.map +1 -0
  86. package/lib/commonjs/utils/file.js +2 -2
  87. package/lib/commonjs/utils/getConfigCamera.js +1 -1
  88. package/lib/commonjs/utils/getConfigCamera.js.map +1 -1
  89. package/lib/module/components/CameraConfigInfo/index.js +15 -0
  90. package/lib/module/components/CameraConfigInfo/index.js.map +1 -0
  91. package/lib/module/components/CameraConfigInfo/styles.js +14 -0
  92. package/lib/module/components/CameraConfigInfo/styles.js.map +1 -0
  93. package/lib/module/components/CaptureButton/index.js +79 -0
  94. package/lib/module/components/CaptureButton/index.js.map +1 -0
  95. package/lib/module/components/CaptureButton/styles.js +16 -0
  96. package/lib/module/components/CaptureButton/styles.js.map +1 -0
  97. package/lib/module/components/Gabarito/index.js +5 -4
  98. package/lib/module/components/Gabarito/index.js.map +1 -1
  99. package/lib/module/components/Gabarito/styles.js +11 -12
  100. package/lib/module/components/Gabarito/styles.js.map +1 -1
  101. package/lib/module/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/index.js +17 -15
  102. package/lib/module/components/HelpRegister/index.js.map +1 -0
  103. package/lib/module/components/HelpRegister/styles.js +53 -0
  104. package/lib/module/components/HelpRegister/styles.js.map +1 -0
  105. package/lib/module/components/Toast/Toast.js +14 -14
  106. package/lib/module/components/Toast/Toast.js.map +1 -1
  107. package/lib/module/components/deviceNotFound/deviceNotFound.js +20 -0
  108. package/lib/module/components/deviceNotFound/deviceNotFound.js.map +1 -0
  109. package/lib/module/components/deviceNotFound/styles.js +30 -0
  110. package/lib/module/components/deviceNotFound/styles.js.map +1 -0
  111. package/lib/module/components/icon/icon.js +15 -0
  112. package/lib/module/components/icon/icon.js.map +1 -0
  113. package/lib/module/components/index.js +9 -0
  114. package/lib/module/components/index.js.map +1 -0
  115. package/lib/module/components/modalMessage/modalMessage.js +54 -0
  116. package/lib/module/components/modalMessage/modalMessage.js.map +1 -0
  117. package/lib/module/components/modalMessage/styles.js +45 -0
  118. package/lib/module/components/modalMessage/styles.js.map +1 -0
  119. package/lib/module/components/recordButton/recordButton.js +74 -0
  120. package/lib/module/components/recordButton/recordButton.js.map +1 -0
  121. package/lib/module/components/recordButton/styles.js +15 -0
  122. package/lib/module/components/recordButton/styles.js.map +1 -0
  123. package/lib/module/index.js +4 -4
  124. package/lib/module/index.js.map +1 -1
  125. package/lib/module/screens/CadastroScreen/CadastroScreen.js +33 -33
  126. package/lib/module/screens/CadastroScreen/CadastroScreen.js.map +1 -1
  127. package/lib/module/screens/FingerAuth/FingerAuth.js +119 -0
  128. package/lib/module/screens/FingerAuth/FingerAuth.js.map +1 -0
  129. package/lib/module/screens/FingerAuth/styles.js +29 -0
  130. package/lib/module/screens/FingerAuth/styles.js.map +1 -0
  131. package/lib/module/screens/FingerRegister/index.js +129 -0
  132. package/lib/module/screens/FingerRegister/index.js.map +1 -0
  133. package/lib/module/screens/FingerRegister/styles.js +29 -0
  134. package/lib/module/screens/FingerRegister/styles.js.map +1 -0
  135. package/lib/module/screens/LifeCertificate/index.js +136 -0
  136. package/lib/module/screens/LifeCertificate/index.js.map +1 -0
  137. package/lib/module/screens/LifeCertificate/styles.js +21 -0
  138. package/lib/module/screens/LifeCertificate/styles.js.map +1 -0
  139. package/lib/module/screens/index.js +5 -0
  140. package/lib/module/screens/index.js.map +1 -0
  141. package/lib/module/services/index.js +9 -95
  142. package/lib/module/services/index.js.map +1 -1
  143. package/lib/module/services/services.js +123 -0
  144. package/lib/module/services/services.js.map +1 -0
  145. package/lib/module/services/types.js +2 -0
  146. package/lib/module/{types/screen.js.map → services/types.js.map} +1 -1
  147. package/lib/module/store/createSelectors.js +10 -0
  148. package/lib/module/store/createSelectors.js.map +1 -0
  149. package/lib/module/store/modules/fingerAuth/index.js +3 -0
  150. package/lib/module/store/modules/fingerAuth/index.js.map +1 -0
  151. package/lib/module/store/modules/fingerAuth/selectors.js +6 -0
  152. package/lib/module/store/modules/fingerAuth/selectors.js.map +1 -0
  153. package/lib/module/store/modules/fingerAuth/slice.js +86 -0
  154. package/lib/module/store/modules/fingerAuth/slice.js.map +1 -0
  155. package/lib/module/store/modules/fingerAuth/type.js +2 -0
  156. package/lib/module/store/modules/fingerAuth/type.js.map +1 -0
  157. package/lib/module/store/modules/fingerRegister/index.js +3 -0
  158. package/lib/module/store/modules/fingerRegister/index.js.map +1 -0
  159. package/lib/module/store/modules/fingerRegister/selectors.js +6 -0
  160. package/lib/module/store/modules/fingerRegister/selectors.js.map +1 -0
  161. package/lib/module/store/modules/fingerRegister/slice.js +95 -0
  162. package/lib/module/store/modules/fingerRegister/slice.js.map +1 -0
  163. package/lib/module/store/modules/fingerRegister/types.js +2 -0
  164. package/lib/module/store/modules/fingerRegister/types.js.map +1 -0
  165. package/lib/module/store/modules/lifeCertificate/index.js +3 -0
  166. package/lib/module/store/modules/lifeCertificate/index.js.map +1 -0
  167. package/lib/module/store/modules/lifeCertificate/selectors.js +6 -0
  168. package/lib/module/store/modules/lifeCertificate/selectors.js.map +1 -0
  169. package/lib/module/store/modules/lifeCertificate/slice.js +95 -0
  170. package/lib/module/store/modules/lifeCertificate/slice.js.map +1 -0
  171. package/lib/module/store/modules/lifeCertificate/types.js +2 -0
  172. package/lib/module/store/modules/lifeCertificate/types.js.map +1 -0
  173. package/lib/module/utils/file.js +3 -3
  174. package/lib/module/utils/getConfigCamera.js +4 -4
  175. package/lib/module/utils/getConfigCamera.js.map +1 -1
  176. package/lib/module/utils/index.js +1 -1
  177. package/lib/typescript/src/components/CameraConfigInfo/index.d.ts +8 -0
  178. package/lib/typescript/src/components/CameraConfigInfo/index.d.ts.map +1 -0
  179. package/lib/typescript/src/components/CameraConfigInfo/styles.d.ts +13 -0
  180. package/lib/typescript/src/components/CameraConfigInfo/styles.d.ts.map +1 -0
  181. package/lib/typescript/src/components/CaptureButton/index.d.ts +10 -0
  182. package/lib/typescript/src/components/CaptureButton/index.d.ts.map +1 -0
  183. package/lib/typescript/src/components/CaptureButton/styles.d.ts +15 -0
  184. package/lib/typescript/src/components/CaptureButton/styles.d.ts.map +1 -0
  185. package/lib/typescript/src/components/Gabarito/index.d.ts +2 -1
  186. package/lib/typescript/src/components/Gabarito/index.d.ts.map +1 -1
  187. package/lib/typescript/src/components/Gabarito/styles.d.ts +1 -2
  188. package/lib/typescript/src/components/Gabarito/styles.d.ts.map +1 -1
  189. package/lib/typescript/src/components/HelpRegister/index.d.ts +4 -0
  190. package/lib/typescript/src/components/HelpRegister/index.d.ts.map +1 -0
  191. package/lib/typescript/src/{screens/CadastroFinger/components/AjudaCadastro → components/HelpRegister}/styles.d.ts +2 -5
  192. package/lib/typescript/src/components/HelpRegister/styles.d.ts.map +1 -0
  193. package/lib/typescript/src/components/Toast/Toast.d.ts +1 -1
  194. package/lib/typescript/src/components/Toast/Toast.d.ts.map +1 -1
  195. package/lib/typescript/src/components/deviceNotFound/deviceNotFound.d.ts +8 -0
  196. package/lib/typescript/src/components/deviceNotFound/deviceNotFound.d.ts.map +1 -0
  197. package/lib/typescript/src/components/deviceNotFound/styles.d.ts +29 -0
  198. package/lib/typescript/src/components/deviceNotFound/styles.d.ts.map +1 -0
  199. package/lib/typescript/src/components/icon/icon.d.ts +9 -0
  200. package/lib/typescript/src/components/icon/icon.d.ts.map +1 -0
  201. package/lib/typescript/src/components/index.d.ts +9 -0
  202. package/lib/typescript/src/components/index.d.ts.map +1 -0
  203. package/lib/typescript/src/components/modalMessage/modalMessage.d.ts +11 -0
  204. package/lib/typescript/src/components/modalMessage/modalMessage.d.ts.map +1 -0
  205. package/lib/typescript/src/components/modalMessage/styles.d.ts +44 -0
  206. package/lib/typescript/src/components/modalMessage/styles.d.ts.map +1 -0
  207. package/lib/typescript/src/components/recordButton/recordButton.d.ts +10 -0
  208. package/lib/typescript/src/components/recordButton/recordButton.d.ts.map +1 -0
  209. package/lib/typescript/src/components/recordButton/styles.d.ts +14 -0
  210. package/lib/typescript/src/components/recordButton/styles.d.ts.map +1 -0
  211. package/lib/typescript/src/index.d.ts +3 -4
  212. package/lib/typescript/src/index.d.ts.map +1 -1
  213. package/lib/typescript/src/screens/CadastroScreen/CadastroScreen.d.ts +2 -4
  214. package/lib/typescript/src/screens/CadastroScreen/CadastroScreen.d.ts.map +1 -1
  215. package/lib/typescript/src/screens/FingerAuth/FingerAuth.d.ts +9 -0
  216. package/lib/typescript/src/screens/FingerAuth/FingerAuth.d.ts.map +1 -0
  217. package/lib/typescript/src/screens/FingerAuth/styles.d.ts +25 -0
  218. package/lib/typescript/src/screens/FingerAuth/styles.d.ts.map +1 -0
  219. package/lib/typescript/src/screens/FingerRegister/index.d.ts +9 -0
  220. package/lib/typescript/src/screens/FingerRegister/index.d.ts.map +1 -0
  221. package/lib/typescript/src/screens/FingerRegister/styles.d.ts +25 -0
  222. package/lib/typescript/src/screens/FingerRegister/styles.d.ts.map +1 -0
  223. package/lib/typescript/src/screens/LifeCertificate/index.d.ts +7 -0
  224. package/lib/typescript/src/screens/LifeCertificate/index.d.ts.map +1 -0
  225. package/lib/typescript/src/{components/WaitingForResult → screens/LifeCertificate}/styles.d.ts +7 -11
  226. package/lib/typescript/src/screens/LifeCertificate/styles.d.ts.map +1 -0
  227. package/lib/typescript/src/screens/index.d.ts +5 -0
  228. package/lib/typescript/src/screens/index.d.ts.map +1 -0
  229. package/lib/typescript/src/services/index.d.ts +2 -17
  230. package/lib/typescript/src/services/index.d.ts.map +1 -1
  231. package/lib/typescript/src/services/services.d.ts +6 -0
  232. package/lib/typescript/src/services/services.d.ts.map +1 -0
  233. package/lib/typescript/src/services/types.d.ts +37 -0
  234. package/lib/typescript/src/services/types.d.ts.map +1 -0
  235. package/lib/typescript/src/store/createSelectors.d.ts +11 -0
  236. package/lib/typescript/src/store/createSelectors.d.ts.map +1 -0
  237. package/lib/typescript/src/store/modules/fingerAuth/index.d.ts +3 -0
  238. package/lib/typescript/src/store/modules/fingerAuth/index.d.ts.map +1 -0
  239. package/lib/typescript/src/store/modules/fingerAuth/selectors.d.ts +20 -0
  240. package/lib/typescript/src/store/modules/fingerAuth/selectors.d.ts.map +1 -0
  241. package/lib/typescript/src/store/modules/fingerAuth/slice.d.ts +4 -0
  242. package/lib/typescript/src/store/modules/fingerAuth/slice.d.ts.map +1 -0
  243. package/lib/typescript/src/store/modules/fingerAuth/type.d.ts +28 -0
  244. package/lib/typescript/src/store/modules/fingerAuth/type.d.ts.map +1 -0
  245. package/lib/typescript/src/store/modules/fingerRegister/index.d.ts +3 -0
  246. package/lib/typescript/src/store/modules/fingerRegister/index.d.ts.map +1 -0
  247. package/lib/typescript/src/store/modules/fingerRegister/selectors.d.ts +22 -0
  248. package/lib/typescript/src/store/modules/fingerRegister/selectors.d.ts.map +1 -0
  249. package/lib/typescript/src/store/modules/fingerRegister/slice.d.ts +4 -0
  250. package/lib/typescript/src/store/modules/fingerRegister/slice.d.ts.map +1 -0
  251. package/lib/typescript/src/store/modules/fingerRegister/types.d.ts +30 -0
  252. package/lib/typescript/src/store/modules/fingerRegister/types.d.ts.map +1 -0
  253. package/lib/typescript/src/store/modules/lifeCertificate/index.d.ts +3 -0
  254. package/lib/typescript/src/store/modules/lifeCertificate/index.d.ts.map +1 -0
  255. package/lib/typescript/src/store/modules/lifeCertificate/selectors.d.ts +23 -0
  256. package/lib/typescript/src/store/modules/lifeCertificate/selectors.d.ts.map +1 -0
  257. package/lib/typescript/src/store/modules/lifeCertificate/slice.d.ts +4 -0
  258. package/lib/typescript/src/store/modules/lifeCertificate/slice.d.ts.map +1 -0
  259. package/lib/typescript/src/store/modules/lifeCertificate/types.d.ts +37 -0
  260. package/lib/typescript/src/store/modules/lifeCertificate/types.d.ts.map +1 -0
  261. package/lib/typescript/src/utils/getConfigCamera.d.ts +1 -1
  262. package/lib/typescript/src/utils/getConfigCamera.d.ts.map +1 -1
  263. package/lib/typescript/src/utils/index.d.ts +1 -1
  264. package/package.json +24 -42
  265. package/src/components/CameraConfigInfo/index.tsx +20 -0
  266. package/src/components/CameraConfigInfo/styles.ts +14 -0
  267. package/src/components/CaptureButton/index.tsx +74 -0
  268. package/src/components/CaptureButton/styles.ts +16 -0
  269. package/src/components/Gabarito/index.tsx +6 -4
  270. package/src/components/Gabarito/styles.ts +13 -14
  271. package/src/components/HelpRegister/index.tsx +40 -0
  272. package/src/components/HelpRegister/styles.ts +54 -0
  273. package/src/components/Toast/Toast.tsx +18 -22
  274. package/src/components/deviceNotFound/deviceNotFound.tsx +23 -0
  275. package/src/components/deviceNotFound/styles.ts +30 -0
  276. package/src/components/icon/icon.tsx +14 -0
  277. package/src/components/index.ts +9 -0
  278. package/src/components/modalMessage/modalMessage.tsx +73 -0
  279. package/src/components/modalMessage/styles.ts +45 -0
  280. package/src/components/recordButton/recordButton.tsx +75 -0
  281. package/src/components/recordButton/styles.ts +15 -0
  282. package/src/index.tsx +5 -4
  283. package/src/screens/CadastroScreen/CadastroScreen.tsx +35 -52
  284. package/src/screens/FingerAuth/FingerAuth.tsx +121 -0
  285. package/src/screens/FingerAuth/styles.ts +28 -0
  286. package/src/screens/FingerRegister/index.tsx +141 -0
  287. package/src/screens/FingerRegister/styles.ts +28 -0
  288. package/src/screens/LifeCertificate/index.tsx +152 -0
  289. package/src/screens/LifeCertificate/styles.ts +21 -0
  290. package/src/screens/index.ts +5 -0
  291. package/src/services/index.ts +12 -113
  292. package/src/services/services.ts +129 -0
  293. package/src/services/types.ts +42 -0
  294. package/src/store/createSelectors.ts +15 -0
  295. package/src/store/modules/fingerAuth/index.ts +3 -0
  296. package/src/store/modules/fingerAuth/selectors.ts +7 -0
  297. package/src/store/modules/fingerAuth/slice.ts +91 -0
  298. package/src/store/modules/fingerAuth/type.ts +29 -0
  299. package/src/store/modules/fingerRegister/index.ts +3 -0
  300. package/src/store/modules/fingerRegister/selectors.ts +7 -0
  301. package/src/store/modules/fingerRegister/slice.ts +101 -0
  302. package/src/store/modules/fingerRegister/types.ts +30 -0
  303. package/src/store/modules/lifeCertificate/index.ts +3 -0
  304. package/src/store/modules/lifeCertificate/selectors.ts +7 -0
  305. package/src/store/modules/lifeCertificate/slice.ts +100 -0
  306. package/src/store/modules/lifeCertificate/types.ts +40 -0
  307. package/src/utils/file.ts +3 -3
  308. package/src/utils/getConfigCamera.ts +7 -12
  309. package/src/utils/index.ts +1 -1
  310. package/lib/commonjs/components/CameraConfigInfos/index.js +0 -21
  311. package/lib/commonjs/components/CameraConfigInfos/index.js.map +0 -1
  312. package/lib/commonjs/components/CameraConfigInfos/styles.js +0 -19
  313. package/lib/commonjs/components/CameraConfigInfos/styles.js.map +0 -1
  314. package/lib/commonjs/components/DeviceNullDisplay/index.js +0 -59
  315. package/lib/commonjs/components/DeviceNullDisplay/index.js.map +0 -1
  316. package/lib/commonjs/components/ErrorDisplay/index.js +0 -59
  317. package/lib/commonjs/components/ErrorDisplay/index.js.map +0 -1
  318. package/lib/commonjs/components/WaitingForResult/index.js.map +0 -1
  319. package/lib/commonjs/components/WaitingForResult/styles.js +0 -32
  320. package/lib/commonjs/components/WaitingForResult/styles.js.map +0 -1
  321. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/index.js +0 -49
  322. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/index.js.map +0 -1
  323. package/lib/commonjs/screens/CadastroFinger/components/AjudaCadastro/styles.js.map +0 -1
  324. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/index.js +0 -298
  325. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/index.js.map +0 -1
  326. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/styles.js +0 -54
  327. package/lib/commonjs/screens/CadastroFinger/components/CameraCadastro/styles.js.map +0 -1
  328. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/index.js +0 -44
  329. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/index.js.map +0 -1
  330. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/styles.js +0 -65
  331. package/lib/commonjs/screens/CadastroFinger/components/ImageDisplayScreen/styles.js.map +0 -1
  332. package/lib/commonjs/screens/CadastroFinger/index.js +0 -50
  333. package/lib/commonjs/screens/CadastroFinger/index.js.map +0 -1
  334. package/lib/commonjs/screens/ProvaVidas/index.js +0 -246
  335. package/lib/commonjs/screens/ProvaVidas/index.js.map +0 -1
  336. package/lib/commonjs/screens/ProvaVidas/styles.js +0 -93
  337. package/lib/commonjs/screens/ProvaVidas/styles.js.map +0 -1
  338. package/lib/commonjs/screens/ValidadeFinger/index.js +0 -216
  339. package/lib/commonjs/screens/ValidadeFinger/index.js.map +0 -1
  340. package/lib/commonjs/screens/ValidadeFinger/styles.js +0 -54
  341. package/lib/commonjs/screens/ValidadeFinger/styles.js.map +0 -1
  342. package/lib/commonjs/types/screen.js +0 -2
  343. package/lib/module/components/CameraConfigInfos/index.js +0 -13
  344. package/lib/module/components/CameraConfigInfos/index.js.map +0 -1
  345. package/lib/module/components/CameraConfigInfos/styles.js +0 -13
  346. package/lib/module/components/CameraConfigInfos/styles.js.map +0 -1
  347. package/lib/module/components/DeviceNullDisplay/index.js +0 -51
  348. package/lib/module/components/DeviceNullDisplay/index.js.map +0 -1
  349. package/lib/module/components/ErrorDisplay/index.js +0 -51
  350. package/lib/module/components/ErrorDisplay/index.js.map +0 -1
  351. package/lib/module/components/WaitingForResult/index.js +0 -17
  352. package/lib/module/components/WaitingForResult/index.js.map +0 -1
  353. package/lib/module/components/WaitingForResult/styles.js +0 -26
  354. package/lib/module/components/WaitingForResult/styles.js.map +0 -1
  355. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/index.js.map +0 -1
  356. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/styles.js +0 -56
  357. package/lib/module/screens/CadastroFinger/components/AjudaCadastro/styles.js.map +0 -1
  358. package/lib/module/screens/CadastroFinger/components/CameraCadastro/index.js +0 -288
  359. package/lib/module/screens/CadastroFinger/components/CameraCadastro/index.js.map +0 -1
  360. package/lib/module/screens/CadastroFinger/components/CameraCadastro/styles.js +0 -48
  361. package/lib/module/screens/CadastroFinger/components/CameraCadastro/styles.js.map +0 -1
  362. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/index.js +0 -36
  363. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/index.js.map +0 -1
  364. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/styles.js +0 -59
  365. package/lib/module/screens/CadastroFinger/components/ImageDisplayScreen/styles.js.map +0 -1
  366. package/lib/module/screens/CadastroFinger/index.js +0 -42
  367. package/lib/module/screens/CadastroFinger/index.js.map +0 -1
  368. package/lib/module/screens/ProvaVidas/index.js +0 -239
  369. package/lib/module/screens/ProvaVidas/index.js.map +0 -1
  370. package/lib/module/screens/ProvaVidas/styles.js +0 -87
  371. package/lib/module/screens/ProvaVidas/styles.js.map +0 -1
  372. package/lib/module/screens/ValidadeFinger/index.js +0 -206
  373. package/lib/module/screens/ValidadeFinger/index.js.map +0 -1
  374. package/lib/module/screens/ValidadeFinger/styles.js +0 -48
  375. package/lib/module/screens/ValidadeFinger/styles.js.map +0 -1
  376. package/lib/module/types/screen.js +0 -2
  377. package/lib/typescript/src/components/CameraConfigInfos/index.d.ts +0 -9
  378. package/lib/typescript/src/components/CameraConfigInfos/index.d.ts.map +0 -1
  379. package/lib/typescript/src/components/CameraConfigInfos/styles.d.ts +0 -11
  380. package/lib/typescript/src/components/CameraConfigInfos/styles.d.ts.map +0 -1
  381. package/lib/typescript/src/components/DeviceNullDisplay/index.d.ts +0 -11
  382. package/lib/typescript/src/components/DeviceNullDisplay/index.d.ts.map +0 -1
  383. package/lib/typescript/src/components/ErrorDisplay/index.d.ts +0 -11
  384. package/lib/typescript/src/components/ErrorDisplay/index.d.ts.map +0 -1
  385. package/lib/typescript/src/components/WaitingForResult/index.d.ts +0 -7
  386. package/lib/typescript/src/components/WaitingForResult/index.d.ts.map +0 -1
  387. package/lib/typescript/src/components/WaitingForResult/styles.d.ts.map +0 -1
  388. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/index.d.ts +0 -7
  389. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/index.d.ts.map +0 -1
  390. package/lib/typescript/src/screens/CadastroFinger/components/AjudaCadastro/styles.d.ts.map +0 -1
  391. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/index.d.ts +0 -16
  392. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/index.d.ts.map +0 -1
  393. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/styles.d.ts +0 -44
  394. package/lib/typescript/src/screens/CadastroFinger/components/CameraCadastro/styles.d.ts.map +0 -1
  395. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/index.d.ts +0 -12
  396. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/index.d.ts.map +0 -1
  397. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.d.ts +0 -54
  398. package/lib/typescript/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.d.ts.map +0 -1
  399. package/lib/typescript/src/screens/CadastroFinger/index.d.ts +0 -16
  400. package/lib/typescript/src/screens/CadastroFinger/index.d.ts.map +0 -1
  401. package/lib/typescript/src/screens/ProvaVidas/index.d.ts +0 -14
  402. package/lib/typescript/src/screens/ProvaVidas/index.d.ts.map +0 -1
  403. package/lib/typescript/src/screens/ProvaVidas/styles.d.ts +0 -85
  404. package/lib/typescript/src/screens/ProvaVidas/styles.d.ts.map +0 -1
  405. package/lib/typescript/src/screens/ValidadeFinger/index.d.ts +0 -14
  406. package/lib/typescript/src/screens/ValidadeFinger/index.d.ts.map +0 -1
  407. package/lib/typescript/src/screens/ValidadeFinger/styles.d.ts +0 -44
  408. package/lib/typescript/src/screens/ValidadeFinger/styles.d.ts.map +0 -1
  409. package/lib/typescript/src/types/screen.d.ts +0 -6
  410. package/lib/typescript/src/types/screen.d.ts.map +0 -1
  411. package/live-id-sdk.podspec +0 -41
  412. package/src/components/CameraConfigInfos/index.tsx +0 -25
  413. package/src/components/CameraConfigInfos/styles.ts +0 -13
  414. package/src/components/DeviceNullDisplay/index.tsx +0 -59
  415. package/src/components/ErrorDisplay/index.tsx +0 -60
  416. package/src/components/WaitingForResult/index.tsx +0 -22
  417. package/src/components/WaitingForResult/styles.ts +0 -27
  418. package/src/screens/CadastroFinger/components/AjudaCadastro/index.tsx +0 -49
  419. package/src/screens/CadastroFinger/components/AjudaCadastro/styles.ts +0 -56
  420. package/src/screens/CadastroFinger/components/CameraCadastro/index.tsx +0 -356
  421. package/src/screens/CadastroFinger/components/CameraCadastro/styles.ts +0 -47
  422. package/src/screens/CadastroFinger/components/ImageDisplayScreen/index.tsx +0 -45
  423. package/src/screens/CadastroFinger/components/ImageDisplayScreen/styles.ts +0 -55
  424. package/src/screens/CadastroFinger/index.tsx +0 -56
  425. package/src/screens/ProvaVidas/index.tsx +0 -308
  426. package/src/screens/ProvaVidas/styles.ts +0 -99
  427. package/src/screens/ValidadeFinger/index.tsx +0 -263
  428. package/src/screens/ValidadeFinger/styles.ts +0 -47
  429. package/src/types/screen.ts +0 -5
@@ -1,308 +0,0 @@
1
- /* eslint-disable react-native/no-inline-styles */
2
- import React, { useCallback, useEffect, useRef, useState } from 'react';
3
- import { Text, View, TouchableOpacity, Button } from 'react-native';
4
- import {
5
- Camera,
6
- useCameraDevice,
7
- useCameraFormat,
8
- type VideoFile,
9
- } from 'react-native-vision-camera';
10
- import Modal, { type ModalProps } from 'react-native-modal';
11
- import { Toast } from '../../components/Toast/Toast';
12
- import { provaVida } from '../../services';
13
- import { getConfigCamera } from '../../utils';
14
- import { Alert } from 'react-native';
15
- import type { ScreenProps } from '../../types/screen';
16
- import { Platform } from 'react-native';
17
- import Orientation from 'react-native-orientation-locker';
18
- import { WaitingForResult } from '../../components/WaitingForResult';
19
- import { ErrorDisplay } from '../../components/ErrorDisplay';
20
- import { DeviceNullDisplay } from '../../components/DeviceNullDisplay';
21
- import { styles } from './styles';
22
- import { CameraConfigInfos } from '../../components/CameraConfigInfos';
23
-
24
- const IS_IOS = Platform.OS === 'ios';
25
-
26
- interface CameraProvaVidasProps {
27
- isVisible: boolean;
28
- onCloseModal?: () => void;
29
- onError?: (response?: any) => void;
30
- onSuccess?: (response?: any) => void;
31
- ModalParams?: ModalProps;
32
- screenProps?: ScreenProps;
33
- }
34
-
35
- type GetConfigApi = {
36
- id: number;
37
- deviceModels: string[];
38
- deviceType: string;
39
- fps: number;
40
- exposure: number;
41
- zoom: number;
42
- serviceType: string;
43
- showButtonInfo: boolean;
44
- };
45
-
46
- export const CameraProvaVidas: React.FC<CameraProvaVidasProps> = ({
47
- isVisible = false,
48
- onCloseModal,
49
- onError,
50
- onSuccess,
51
- ModalParams,
52
- screenProps,
53
- }) => {
54
- const id = screenProps?.id;
55
- const camera = useRef<Camera>(null);
56
-
57
- const [showOverlay, setShowOverlay] = useState(false);
58
- const [intervalState, setIntervalState] = useState<NodeJS.Timeout | null>(
59
- null
60
- );
61
-
62
- const [timer, setTimer] = useState(0);
63
- const [load, setLoad] = useState(false);
64
- const [stateToastBpm, setStateToastBpm] = useState({
65
- message: '',
66
- visible: false,
67
- });
68
- const [isRecording, setIsRecording] = useState(false);
69
- const [cameraConfigs, setCameraConfigs] = useState<GetConfigApi>();
70
-
71
- // mantem a tela em modo portrait
72
- useEffect(() => {
73
- Orientation.lockToPortrait();
74
- return () => {
75
- Orientation.unlockAllOrientations();
76
- };
77
- }, []);
78
-
79
- // Pega a permissão da camera do dispositivo
80
- const requestCameraPermission = useCallback(async () => {
81
- try {
82
- await Camera.requestCameraPermission();
83
- } catch (error) {}
84
- }, []);
85
-
86
- // pra garantir que a permissão da camera seja solicitada
87
- useEffect(() => {
88
- requestCameraPermission();
89
- }, [requestCameraPermission]);
90
-
91
- useEffect(() => {
92
- getConfigCamera('liveness')
93
- .then((config) => {
94
- setCameraConfigs(config);
95
- })
96
- .catch((error) => {
97
- console.error(error);
98
- });
99
- }, []);
100
-
101
- const device = useCameraDevice('back', {
102
- physicalDevices: ['wide-angle-camera'],
103
- });
104
-
105
- const cameraFormat = useCameraFormat(device, [
106
- {
107
- videoResolution: {
108
- height: 1280,
109
- width: 720,
110
- },
111
- },
112
- ]);
113
-
114
- // Envia o arquivo para a api
115
- const sendFile = useCallback(
116
- async (file: VideoFile) => {
117
- setLoad(true);
118
-
119
- if (!id)
120
- return Alert.alert(
121
- 'Erro ao enviar o arquivo ( id error ), tente novamente mais tarde'
122
- );
123
-
124
- let req = await provaVida(file, id, cameraConfigs?.exposure);
125
-
126
- if (req.code === 0 && req.bpm >= 0) {
127
- setShowOverlay(false);
128
-
129
- const optionsToast = {
130
- message: `Seu batimento esta em: ${req.bpm}.\n Prova de vida concluida !`,
131
- visible: true,
132
- };
133
- setStateToastBpm(optionsToast);
134
- onSuccess && onSuccess(req);
135
- } else {
136
- Alert.alert(req.message);
137
- onError && onError(req);
138
- }
139
- setLoad(false);
140
- setShowOverlay(false);
141
- return;
142
- },
143
- [cameraConfigs?.exposure, id, onError, onSuccess]
144
- );
145
-
146
- // Limpa tudo
147
- useEffect(() => {
148
- return () => {
149
- // limpa tudo
150
- setTimer(0);
151
- setIsRecording(false);
152
- setLoad(false);
153
- setStateToastBpm({ message: '', visible: false });
154
- };
155
- }, []);
156
-
157
- // Limpa o intervalo do timer
158
- useEffect(() => {
159
- if (timer < 0) {
160
- if (!intervalState) return;
161
- clearInterval(intervalState);
162
- stopRecodingVideo();
163
- }
164
- }, [timer, intervalState]);
165
-
166
- // Função para iniciar a gravação do video na referencia da camera
167
- const startVideoRecording = useCallback(() => {
168
- setIsRecording(true);
169
-
170
- camera.current?.startRecording({
171
- fileType: 'mp4',
172
- onRecordingFinished: (video) => sendFile(video),
173
- onRecordingError: (error) => console.error(error),
174
- });
175
- }, [sendFile]);
176
-
177
- // Inicia a gravação do video
178
- const recordingVideo = useCallback(async () => {
179
- startVideoRecording();
180
- setTimer(10);
181
- setLoad(true);
182
-
183
- setIntervalState(
184
- setInterval(() => {
185
- setTimer((prevTimer) => prevTimer - 1); // Update the timer state
186
- }, 1000)
187
- );
188
- }, [startVideoRecording]);
189
-
190
- // Para a gravação do video
191
- const stopRecodingVideo = async () => {
192
- setIsRecording(false);
193
- await camera.current?.stopRecording();
194
- setShowOverlay(true);
195
- return;
196
- };
197
-
198
- // Fecha o modal
199
- const onCloseModalHandler = () => {
200
- resetScreenStatesAndCamera();
201
- onCloseModal && onCloseModal();
202
- };
203
-
204
- // Limpa os estados da tela e a camera
205
- const resetScreenStatesAndCamera = () => {
206
- setTimer(0);
207
- setIsRecording(false);
208
- setShowOverlay(false);
209
- setLoad(false);
210
- setStateToastBpm({ message: '', visible: false });
211
- };
212
-
213
- if (!screenProps && isVisible) {
214
- return (
215
- <ErrorDisplay
216
- isVisible={isVisible}
217
- modalParams={ModalParams}
218
- onCloseModalHandler={onCloseModalHandler}
219
- requestCameraPermission={requestCameraPermission}
220
- />
221
- );
222
- }
223
-
224
- if (device == null) {
225
- return (
226
- <DeviceNullDisplay
227
- isVisible={isVisible}
228
- modalParams={ModalParams}
229
- onCloseModalHandler={onCloseModalHandler}
230
- requestCameraPermission={requestCameraPermission}
231
- />
232
- );
233
- }
234
-
235
- return (
236
- <Modal
237
- style={{ margin: 0 }}
238
- isVisible={isVisible}
239
- swipeDirection="down"
240
- propagateSwipe={true}
241
- onSwipeComplete={onCloseModalHandler}
242
- {...ModalParams}
243
- >
244
- <View style={styles.container}>
245
- {showOverlay && (
246
- <WaitingForResult
247
- onPress={() => {
248
- setShowOverlay(false);
249
- }}
250
- />
251
- )}
252
-
253
- <Toast
254
- message={stateToastBpm.message}
255
- isVisible={stateToastBpm.visible}
256
- onClose={onCloseModalHandler}
257
- />
258
-
259
- <View style={styles.containerCamera}>
260
- <Camera
261
- ref={camera}
262
- style={styles.subContainer}
263
- isActive={true}
264
- device={device}
265
- video={true}
266
- torch={'on'}
267
- format={cameraFormat}
268
- exposure={cameraConfigs?.exposure}
269
- zoom={cameraConfigs?.zoom}
270
- />
271
- <View style={styles.cameraView} />
272
- <View style={styles.containerTouch}>
273
- <TouchableOpacity
274
- onPress={() => recordingVideo()}
275
- disabled={isRecording || load}
276
- >
277
- <View style={styles.containerText}>
278
- <Text style={styles.textRecording}>
279
- {isRecording
280
- ? `Aguarde ${timer} segundos`
281
- : load
282
- ? 'Processando...'
283
- : 'Medir Batimentos'}
284
- </Text>
285
- </View>
286
- </TouchableOpacity>
287
- </View>
288
- <View
289
- style={{
290
- marginBottom: IS_IOS ? 48 : 0,
291
- }}
292
- >
293
- <CameraConfigInfos
294
- exposure={cameraConfigs?.exposure}
295
- zoom={cameraConfigs?.zoom}
296
- showButtonInfo={cameraConfigs?.showButtonInfo}
297
- />
298
- <Button
299
- disabled={load}
300
- title="Fechar Camera"
301
- onPress={onCloseModalHandler}
302
- />
303
- </View>
304
- </View>
305
- </View>
306
- </Modal>
307
- );
308
- };
@@ -1,99 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
- import { RFValue } from 'react-native-responsive-fontsize';
3
-
4
- export const styles = StyleSheet.create({
5
- container: {
6
- flex: 1,
7
- },
8
-
9
- subContainer: {
10
- flex: 1,
11
- },
12
-
13
- image: {
14
- width: RFValue(200),
15
- height: RFValue(200),
16
- },
17
-
18
- modalImage: {
19
- width: '100%',
20
- height: '100%',
21
- resizeMode: 'contain',
22
- },
23
-
24
- overlay: {
25
- zIndex: 2,
26
- flex: 1,
27
- height: '100%',
28
- width: '100%',
29
- backgroundColor: `rgba(44, 45, 46, 0.5)`,
30
- alignItems: `center`,
31
- justifyContent: `center`,
32
- position: `absolute`,
33
- },
34
-
35
- textOverlay: {
36
- fontSize: RFValue(18),
37
- fontWeight: `500`,
38
- color: `#fff`,
39
- textAlign: `center`,
40
- width: RFValue(300),
41
- marginBottom: RFValue(20),
42
- },
43
-
44
- closeButton: {
45
- position: 'absolute',
46
- top: 20,
47
- right: 20,
48
- },
49
-
50
- closeIcon: {
51
- width: 20,
52
- height: 20,
53
- },
54
-
55
- containerCamera: {
56
- flex: 1,
57
- },
58
-
59
- cameraView: {
60
- width: '100%',
61
- height: RFValue(250),
62
- backgroundColor: `rgba(173, 216, 230, 0)`,
63
- position: `absolute`,
64
- alignSelf: 'center',
65
- marginTop: RFValue(50),
66
- alignItems: `center`,
67
- justifyContent: `center`,
68
- },
69
-
70
- containerTouch: {
71
- height: RFValue(180),
72
- alignItems: 'center',
73
- },
74
-
75
- containerText: {
76
- width: RFValue(280),
77
- height: RFValue(120),
78
- borderRadius: 150,
79
- backgroundColor: `blue`,
80
- alignItems: `center`,
81
- justifyContent: `center`,
82
- marginTop: 10,
83
- },
84
-
85
- textRecording: {
86
- fontSize: RFValue(18),
87
- fontWeight: `500`,
88
- color: `#fff`,
89
- },
90
- containerTextExposureAndZoom: {},
91
- textExposureAndZoom: {
92
- fontSize: 18,
93
- fontWeight: `500`,
94
- color: `#fff`,
95
- textAlign: `center`,
96
- width: RFValue(300),
97
- marginBottom: RFValue(20),
98
- },
99
- });
@@ -1,263 +0,0 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Button, Text, View, Alert, TouchableOpacity } from 'react-native';
3
- import {
4
- Camera,
5
- useCameraFormat,
6
- type Point,
7
- useCameraDevice,
8
- } from 'react-native-vision-camera';
9
- import Modal, { type ModalProps } from 'react-native-modal';
10
- import Orientation from 'react-native-orientation-locker';
11
- import {
12
- Gesture,
13
- GestureDetector,
14
- GestureHandlerRootView,
15
- } from 'react-native-gesture-handler';
16
- import { runOnJS } from 'react-native-reanimated';
17
-
18
- import { verifyDigital } from '../../services';
19
- import { encodeImageToBase64 } from '../../utils/file';
20
- import type { ScreenProps } from '../../types/screen';
21
- import { DeviceNullDisplay } from '../../components/DeviceNullDisplay';
22
- import { ErrorDisplay } from '../../components/ErrorDisplay';
23
- import { Gabarito } from '../../components/Gabarito';
24
- import { WaitingForResult } from '../../components/WaitingForResult';
25
- import { styles } from './styles';
26
- import { CameraConfigInfos } from '../../components/CameraConfigInfos';
27
- import { getConfigCamera } from '../../utils';
28
-
29
- interface ValidaFingerProps {
30
- isVisible: boolean;
31
- ModalParams?: ModalProps;
32
- screenProps?: ScreenProps;
33
- onCloseModal?: () => void;
34
- onError?: (response?: any) => void;
35
- onSuccess?: (response?: any) => void;
36
- }
37
-
38
- type GetConfigApi = {
39
- id: number;
40
- deviceModels: string[];
41
- deviceType: string;
42
- fps: number;
43
- exposure: number;
44
- zoom: number;
45
- serviceType: string;
46
- showButtonInfo: boolean;
47
- };
48
-
49
- export const ValidaFinger: React.FC<ValidaFingerProps> = ({
50
- isVisible = false,
51
- onCloseModal,
52
- onError,
53
- onSuccess,
54
- ModalParams,
55
- screenProps,
56
- }) => {
57
- const id = screenProps?.id;
58
-
59
- const camera = useRef<Camera>(null);
60
- const [showOverlay, setShowOverlay] = useState(false);
61
- const [load, setLoad] = useState(false);
62
- const [cameraConfigs, setCameraConfigs] = useState<GetConfigApi>();
63
-
64
- // mantem a tela em modo portrait
65
- useEffect(() => {
66
- Orientation.lockToPortrait();
67
- return () => {
68
- Orientation.unlockAllOrientations();
69
- };
70
- }, []);
71
-
72
- // Pega a permissão da camera do dispositivo
73
- const requestCameraPermission = useCallback(async () => {
74
- try {
75
- await Camera.requestCameraPermission();
76
- } catch (error) {}
77
- }, []);
78
-
79
- // pra garantir que a permissão da camera seja solicitada
80
- useEffect(() => {
81
- requestCameraPermission();
82
- }, [requestCameraPermission]);
83
-
84
- useEffect(() => {
85
- getConfigCamera('finger')
86
- .then((config) => {
87
- setCameraConfigs(config);
88
- })
89
- .catch((error) => {
90
- console.error(error);
91
- });
92
- }, []);
93
-
94
- const device = useCameraDevice('back', {
95
- physicalDevices: ['wide-angle-camera'],
96
- });
97
-
98
- const cameraFormat = useCameraFormat(device, [
99
- {
100
- photoResolution: {
101
- height: 1280,
102
- width: 720,
103
- },
104
- },
105
- ]);
106
-
107
- const capturedPhoto = async () => {
108
- const snapshot = await camera.current?.takePhoto({
109
- qualityPrioritization: 'speed',
110
- flash: 'on',
111
- });
112
- if (snapshot == null) {
113
- Alert.alert('Erro ao capturar imagem');
114
- return false;
115
- }
116
- let base64 = await encodeImageToBase64(snapshot.path);
117
-
118
- setLoad(true);
119
- setShowOverlay(true);
120
- sendFile(base64);
121
- return true;
122
- };
123
-
124
- // Fecha o modal
125
- const onCloseModalHandler = useCallback(() => {
126
- onCloseModal && onCloseModal();
127
- }, [onCloseModal]);
128
-
129
- // Envia a imagem para a validação da digital
130
- const sendFile = useCallback(
131
- async (image) => {
132
- try {
133
- let UID = id;
134
- let finger = 'DI';
135
- let req = await verifyDigital(UID, finger, image);
136
- if (req.code === 0) {
137
- Alert.alert('Sucesso identificado !');
138
- onSuccess && onSuccess(req);
139
- } else if (req.code === 1) {
140
- Alert.alert('Não Identificado !');
141
- onError && onError(req);
142
- setLoad(false);
143
- } else {
144
- Alert.alert('Erro ao tentar validar');
145
- onError && onError(req);
146
- setLoad(false);
147
- }
148
- setLoad(false);
149
- onCloseModalHandler();
150
- setShowOverlay(false);
151
- } catch (error) {
152
- onError && onError(error);
153
- setShowOverlay(false);
154
- }
155
- },
156
- [id, onError, onSuccess, onCloseModalHandler]
157
- );
158
-
159
- // Foca a camera na posição do toque
160
- const focus = useCallback((point: Point) => {
161
- const c = camera.current;
162
- if (c == null) return;
163
- c.focus(point);
164
- }, []);
165
-
166
- // Gestos para focar a camera
167
- const gesture = Gesture.Tap().onBegin(({ x, y }) => {
168
- runOnJS(focus)({ x, y });
169
- });
170
-
171
- if (!screenProps && isVisible) {
172
- return (
173
- <ErrorDisplay
174
- isVisible={isVisible}
175
- modalParams={ModalParams}
176
- onCloseModalHandler={onCloseModalHandler}
177
- requestCameraPermission={requestCameraPermission}
178
- />
179
- );
180
- }
181
-
182
- if (device == null) {
183
- return (
184
- <DeviceNullDisplay
185
- isVisible={isVisible}
186
- modalParams={ModalParams}
187
- onCloseModalHandler={onCloseModalHandler}
188
- requestCameraPermission={requestCameraPermission}
189
- />
190
- );
191
- }
192
-
193
- if (screenProps) {
194
- return (
195
- <Modal
196
- style={styles.modal}
197
- isVisible={isVisible}
198
- swipeDirection="down"
199
- propagateSwipe={true}
200
- onSwipeComplete={onCloseModalHandler}
201
- {...ModalParams}
202
- >
203
- <GestureHandlerRootView style={styles.root}>
204
- <View style={styles.container}>
205
- {showOverlay && (
206
- <WaitingForResult
207
- onPress={() => {
208
- setShowOverlay(false);
209
- }}
210
- />
211
- )}
212
- <GestureDetector gesture={gesture}>
213
- <View style={styles.cameraContainer}>
214
- <Camera
215
- ref={camera}
216
- format={cameraFormat}
217
- isActive={true}
218
- device={device}
219
- torch={'on'}
220
- exposure={cameraConfigs?.exposure}
221
- zoom={cameraConfigs?.zoom}
222
- photo={true}
223
- enableHighQualityPhotos={true}
224
- style={styles.camera}
225
- />
226
- {!showOverlay && <Gabarito />}
227
- </View>
228
- </GestureDetector>
229
- <View style={styles.containerCapture}>
230
- <TouchableOpacity disabled={load} onPress={() => capturedPhoto()}>
231
- <View style={styles.containerButton}>
232
- {load ? (
233
- <Text style={styles.textButton}>
234
- Verificando Digital...
235
- </Text>
236
- ) : (
237
- <Text style={styles.textButton}>Tirar Foto</Text>
238
- )}
239
- </View>
240
- </TouchableOpacity>
241
- </View>
242
- <View style={styles.containerButtonClose}>
243
- <Button
244
- disabled={load}
245
- title="Fechar Camera"
246
- onPress={onCloseModalHandler}
247
- />
248
- <View style={styles.cameraConfigs}>
249
- <CameraConfigInfos
250
- exposure={cameraConfigs?.exposure}
251
- zoom={cameraConfigs?.zoom}
252
- showButtonInfo={cameraConfigs?.showButtonInfo}
253
- />
254
- </View>
255
- </View>
256
- </View>
257
- </GestureHandlerRootView>
258
- </Modal>
259
- );
260
- }
261
-
262
- return null;
263
- };
@@ -1,47 +0,0 @@
1
- import { StyleSheet, Dimensions, Platform } from 'react-native';
2
-
3
- const { height } = Dimensions.get('window');
4
-
5
- export const styles = StyleSheet.create({
6
- container: {
7
- flex: 1,
8
- },
9
- root: {
10
- flex: 1,
11
- },
12
- cameraContainer: {
13
- flex: 1,
14
- },
15
- camera: {
16
- flex: 1,
17
- justifyContent: 'flex-end',
18
- paddingBottom: height * 0.2,
19
- },
20
- containerCapture: {
21
- height: height * 0.2,
22
- alignItems: 'center',
23
- justifyContent: 'center',
24
- },
25
- containerButton: {
26
- width: 350,
27
- height: 100,
28
- borderRadius: 80,
29
- backgroundColor: 'blue',
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- },
33
- textButton: {
34
- fontSize: 18,
35
- fontWeight: '500',
36
- color: '#fff',
37
- },
38
- modal: {
39
- margin: 0,
40
- },
41
- containerButtonClose: {
42
- marginBottom: Platform.OS === 'ios' ? 48 : 0,
43
- },
44
- cameraConfigs: {
45
- alignItems: 'center',
46
- },
47
- });