react-native-timacare 3.3.28 → 3.3.29

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 (78) hide show
  1. package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
  2. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +29 -26
  3. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -1
  4. package/lib/commonjs/screens/camera/index.js +1 -1
  5. package/lib/commonjs/screens/camera/index.js.flow +34 -48
  6. package/lib/commonjs/screens/camera/index.js.map +1 -1
  7. package/lib/commonjs/screens/home/DigitalTopupItem.js +1 -1
  8. package/lib/commonjs/screens/home/DigitalTopupItem.js.flow +31 -33
  9. package/lib/commonjs/screens/home/DigitalTopupItem.js.map +1 -1
  10. package/lib/commonjs/screens/liveness/index.js +1 -1
  11. package/lib/commonjs/screens/liveness/index.js.flow +43 -54
  12. package/lib/commonjs/screens/liveness/index.js.map +1 -1
  13. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  14. package/lib/commonjs/screens/liveness-v2/index.js.flow +60 -56
  15. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  16. package/lib/commonjs/screens/mrz-scanner/index.js +1 -1
  17. package/lib/commonjs/screens/mrz-scanner/index.js.flow +25 -10
  18. package/lib/commonjs/screens/mrz-scanner/index.js.map +1 -1
  19. package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
  20. package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +48 -49
  21. package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
  22. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
  23. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +32 -33
  24. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  25. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
  26. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +26 -37
  27. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  28. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
  29. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +77 -78
  30. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  31. package/lib/commonjs/screens/uploadVideo/index.js +1 -1
  32. package/lib/commonjs/screens/uploadVideo/index.js.flow +32 -33
  33. package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
  34. package/lib/module/screens/camera/CCCDCameraScreen.js +1 -1
  35. package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -1
  36. package/lib/module/screens/camera/index.js +1 -1
  37. package/lib/module/screens/camera/index.js.map +1 -1
  38. package/lib/module/screens/home/DigitalTopupItem.js +1 -1
  39. package/lib/module/screens/home/DigitalTopupItem.js.map +1 -1
  40. package/lib/module/screens/liveness/index.js +1 -1
  41. package/lib/module/screens/liveness/index.js.map +1 -1
  42. package/lib/module/screens/liveness-v2/index.js +1 -1
  43. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  44. package/lib/module/screens/mrz-scanner/index.js +1 -1
  45. package/lib/module/screens/mrz-scanner/index.js.map +1 -1
  46. package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
  47. package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
  48. package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
  49. package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  50. package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
  51. package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  52. package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
  53. package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  54. package/lib/module/screens/uploadVideo/index.js +1 -1
  55. package/lib/module/screens/uploadVideo/index.js.map +1 -1
  56. package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -1
  57. package/lib/typescript/screens/camera/index.d.ts.map +1 -1
  58. package/lib/typescript/screens/home/DigitalTopupItem.d.ts.map +1 -1
  59. package/lib/typescript/screens/liveness/index.d.ts.map +1 -1
  60. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  61. package/lib/typescript/screens/mrz-scanner/index.d.ts.map +1 -1
  62. package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
  63. package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
  64. package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
  65. package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
  66. package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
  67. package/package.json +1 -2
  68. package/src/screens/camera/CCCDCameraScreen.tsx +29 -26
  69. package/src/screens/camera/index.tsx +34 -48
  70. package/src/screens/home/DigitalTopupItem.tsx +31 -33
  71. package/src/screens/liveness/index.tsx +43 -54
  72. package/src/screens/liveness-v2/index.tsx +60 -56
  73. package/src/screens/mrz-scanner/index.tsx +25 -10
  74. package/src/screens/toan-trinh-so/OCR.tsx +48 -49
  75. package/src/screens/toan-trinh-so/RegisterCamera.tsx +32 -33
  76. package/src/screens/toan-trinh-so/TTSSelfie.tsx +26 -37
  77. package/src/screens/toan-trinh-so/VehicleCamera.tsx +77 -78
  78. package/src/screens/uploadVideo/index.tsx +32 -33
@@ -10,7 +10,10 @@ import {
10
10
  View,
11
11
  } from 'react-native';
12
12
  import { formatDDMMYYY, formatMoney } from '../../utils';
13
- import { RNCamera } from 'react-native-camera';
13
+ import {
14
+ Camera as VisionCamera,
15
+ useCameraDevice,
16
+ } from 'react-native-vision-camera';
14
17
  import MButton from '../../components/MButton';
15
18
  import { IconPause, IconPlay } from '../../assets/icons';
16
19
  import { MText } from '../../components/MText';
@@ -39,6 +42,8 @@ export const Video = observer(function Video(props: any) {
39
42
  const [count, setCount] = useState(COUNTDOWN_SECONDS);
40
43
  const [isRecording, setIsRecording] = useState(false);
41
44
  const [isLoading, setIsLoading] = useState(false);
45
+ const [passPermission, setPassPermission] = useState(false);
46
+ const device = useCameraDevice('front');
42
47
 
43
48
  const loan = props?.route?.params?.loan;
44
49
  const content = useMemo(() => {
@@ -56,7 +61,10 @@ export const Video = observer(function Video(props: any) {
56
61
  (permission) => statuses[permission] !== RESULTS.GRANTED
57
62
  );
58
63
 
59
- if (toRequest.length === 0) return true;
64
+ if (toRequest.length === 0) {
65
+ setPassPermission(true);
66
+ return true;
67
+ }
60
68
 
61
69
  const requested = await requestMultiple(toRequest);
62
70
  const values = Object.values(requested);
@@ -64,6 +72,7 @@ export const Video = observer(function Video(props: any) {
64
72
  const anyBlocked = values.some((status) => status === RESULTS.BLOCKED);
65
73
 
66
74
  if (!allGranted) {
75
+ setPassPermission(false);
67
76
  Alert.alert(
68
77
  'Thông báo',
69
78
  anyBlocked
@@ -81,6 +90,7 @@ export const Video = observer(function Video(props: any) {
81
90
  );
82
91
  }
83
92
 
93
+ setPassPermission(allGranted);
84
94
  return allGranted;
85
95
  };
86
96
 
@@ -114,19 +124,20 @@ export const Video = observer(function Video(props: any) {
114
124
 
115
125
  setIsRecording(true);
116
126
  try {
117
- const data = await camera.current.recordAsync({
118
- quality: RNCamera.Constants.VideoQuality['480p'],
119
- videoBitrate: 1500000,
120
- ...(Platform.OS === 'ios'
121
- ? { codec: RNCamera.Constants.VideoCodec.H264 }
122
- : {}),
127
+ const data = await new Promise((resolve, reject) => {
128
+ camera.current.startRecording({
129
+ videoCodec: Platform.OS === 'ios' ? 'h264' : undefined,
130
+ onRecordingFinished: resolve,
131
+ onRecordingError: reject,
132
+ });
123
133
  });
124
134
 
125
135
  setIsLoading(true);
136
+ const uri = 'file://' + data.path;
126
137
  const formData = new FormData();
127
138
  formData.append('video', {
128
- name: data.uri.split(/[\\/]/).pop(),
129
- uri: data.uri,
139
+ name: data.path.split(/[\\/]/).pop(),
140
+ uri,
130
141
  type: 'video/*',
131
142
  });
132
143
 
@@ -188,27 +199,16 @@ export const Video = observer(function Video(props: any) {
188
199
  </MText>
189
200
  </View>
190
201
  )}
191
- <RNCamera
192
- ref={camera}
193
- style={styles.preview}
194
- type={RNCamera.Constants.Type.front}
195
- permissionDialogTitle={'Permission to use camera'}
196
- permissionDialogMessage={
197
- 'We need your permission to use your camera phone'
198
- }
199
- androidCameraPermissionOptions={{
200
- title: 'Permission to use camera',
201
- message: 'We need your permission to use your camera',
202
- buttonPositive: 'Ok',
203
- buttonNegative: 'Cancel',
204
- }}
205
- androidRecordAudioPermissionOptions={{
206
- title: 'Permission to use audio recording',
207
- message: 'We need your permission to use your audio',
208
- buttonPositive: 'Ok',
209
- buttonNegative: 'Cancel',
210
- }}
211
- />
202
+ {passPermission && device ? (
203
+ <VisionCamera
204
+ ref={camera}
205
+ style={styles.preview}
206
+ device={device}
207
+ isActive={true}
208
+ video={true}
209
+ audio={true}
210
+ />
211
+ ) : null}
212
212
  <View
213
213
  style={{
214
214
  backgroundColor: '#00000080',
@@ -217,6 +217,7 @@ export const Video = observer(function Video(props: any) {
217
217
  bottom: 0,
218
218
  left: 0,
219
219
  right: 0,
220
+ paddingVertical: 16,
220
221
  }}
221
222
  >
222
223
  {isRecording ? (
@@ -224,7 +225,6 @@ export const Video = observer(function Video(props: any) {
224
225
  style={{
225
226
  justifyContent: 'center',
226
227
  alignItems: 'center',
227
- marginBottom: 20,
228
228
  }}
229
229
  onPress={() => {
230
230
  stopRecording();
@@ -237,7 +237,6 @@ export const Video = observer(function Video(props: any) {
237
237
  style={{
238
238
  justifyContent: 'center',
239
239
  alignItems: 'center',
240
- marginBottom: 20,
241
240
  }}
242
241
  disabled={videoStore.isLoading}
243
242
  onPress={() => {