react-native-timacare 3.1.29-production → 3.1.31-production

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 (42) hide show
  1. package/lib/commonjs/screens/home/index.js +1 -1
  2. package/lib/commonjs/screens/home/index.js.flow +5 -27
  3. package/lib/commonjs/screens/home/index.js.map +1 -1
  4. package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
  5. package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +46 -39
  6. package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
  7. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
  8. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +41 -37
  9. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  10. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js +1 -1
  11. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.flow +1 -0
  12. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  13. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  14. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.flow +2 -2
  15. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  16. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
  17. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +39 -37
  18. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  19. package/lib/module/screens/home/index.js +1 -1
  20. package/lib/module/screens/home/index.js.map +1 -1
  21. package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
  22. package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
  23. package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
  24. package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  25. package/lib/module/screens/toan-trinh-so/ReviewInformation.js +1 -1
  26. package/lib/module/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  27. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  28. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  29. package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
  30. package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  31. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  32. package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
  33. package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
  34. package/lib/typescript/screens/toan-trinh-so/ReviewInformation.d.ts.map +1 -1
  35. package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
  36. package/package.json +2 -1
  37. package/src/screens/home/index.tsx +5 -27
  38. package/src/screens/toan-trinh-so/OCR.tsx +46 -39
  39. package/src/screens/toan-trinh-so/RegisterCamera.tsx +41 -37
  40. package/src/screens/toan-trinh-so/ReviewInformation.tsx +1 -0
  41. package/src/screens/toan-trinh-so/ReviewInformationOther.tsx +2 -2
  42. package/src/screens/toan-trinh-so/VehicleCamera.tsx +39 -37
@@ -14,7 +14,7 @@ import {
14
14
  Dimensions,
15
15
  StyleSheet,
16
16
  Alert,
17
- PermissionsAndroid,
17
+ Platform,
18
18
  } from 'react-native';
19
19
  import { MText } from '../../components/MText';
20
20
  import { load, OCR_V1, save } from '../../utils/storage';
@@ -49,6 +49,7 @@ import Loading from '../../components/Loading';
49
49
  import DeviceInfo from 'react-native-device-info';
50
50
  import { IconUpload } from '../../assets/svgs';
51
51
  import ImagePicker from 'react-native-image-crop-picker';
52
+ import { launchImageLibrary } from 'react-native-image-picker';
52
53
 
53
54
  const { NFCReader } = NativeModules;
54
55
 
@@ -149,7 +150,6 @@ export const OCR = observer(function OCR(props: any) {
149
150
 
150
151
  useEffect(() => {
151
152
  let timeout: NodeJS.Timeout;
152
-
153
153
  if (isFocused) {
154
154
  // Delay mounting camera to give Android time to release the previous one
155
155
  timeout = setTimeout(() => {
@@ -321,46 +321,53 @@ export const OCR = observer(function OCR(props: any) {
321
321
 
322
322
  const pickImageFromGallery = async () => {
323
323
  if (Platform.OS === 'android') {
324
- const granted = await PermissionsAndroid.request(
325
- PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES ||
326
- PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
327
- {
328
- title: 'Permission to access photos',
329
- message: 'App needs access to your photos to pick images.',
330
- buttonNeutral: 'Ask Me Later',
331
- buttonNegative: 'Cancel',
332
- buttonPositive: 'OK',
324
+ const result = await launchImageLibrary({
325
+ mediaType: 'photo',
326
+ });
327
+ if (result.assets) {
328
+ if (props?.route?.params?.front && !props.route?.params?.callback) {
329
+ navigation.push(ScreenNames.TTSNationalIDFront, {
330
+ uri: result.assets[0]?.uri,
331
+ loan: props?.route?.params?.loan,
332
+ });
333
+ } else if (
334
+ !props?.route?.params?.front &&
335
+ !props.route?.params?.callback
336
+ ) {
337
+ navigation.push(ScreenNames.TTSNationalIDBack, {
338
+ uri: result.assets[0]?.uri,
339
+ loan: props?.route?.params?.loan,
340
+ });
341
+ } else {
342
+ navigation.goBack();
343
+ props.route?.params?.callback(result.assets[0]?.uri);
333
344
  }
334
- );
335
-
336
- if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
337
- console.log('Permission denied');
338
- return;
339
345
  }
346
+ } else {
347
+ ImagePicker.openPicker({}).then((image) => {
348
+ if (props?.route?.params?.front && !props.route?.params?.callback) {
349
+ navigation.push(ScreenNames.TTSNationalIDFront, {
350
+ uri:
351
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
352
+ loan: props?.route?.params?.loan,
353
+ });
354
+ } else if (
355
+ !props?.route?.params?.front &&
356
+ !props.route?.params?.callback
357
+ ) {
358
+ navigation.push(ScreenNames.TTSNationalIDBack, {
359
+ uri:
360
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
361
+ loan: props?.route?.params?.loan,
362
+ });
363
+ } else {
364
+ navigation.goBack();
365
+ props.route?.params?.callback(
366
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path
367
+ );
368
+ }
369
+ });
340
370
  }
341
- ImagePicker.openPicker({}).then((image) => {
342
- if (props?.route?.params?.front && !props.route?.params?.callback) {
343
- navigation.push(ScreenNames.TTSNationalIDFront, {
344
- uri:
345
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
346
- loan: props?.route?.params?.loan,
347
- });
348
- } else if (
349
- !props?.route?.params?.front &&
350
- !props.route?.params?.callback
351
- ) {
352
- navigation.push(ScreenNames.TTSNationalIDBack, {
353
- uri:
354
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
355
- loan: props?.route?.params?.loan,
356
- });
357
- } else {
358
- navigation.goBack();
359
- props.route?.params?.callback(
360
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path
361
- );
362
- }
363
- });
364
371
  };
365
372
 
366
373
  return (
@@ -5,7 +5,6 @@ import {
5
5
  Dimensions,
6
6
  Image,
7
7
  ImageStyle,
8
- PermissionsAndroid,
9
8
  Platform,
10
9
  SafeAreaView,
11
10
  TextStyle,
@@ -41,6 +40,7 @@ import { ScreenNames } from '../../navigation';
41
40
  import DeviceInfo from 'react-native-device-info';
42
41
  import ImagePicker from 'react-native-image-crop-picker';
43
42
  import { IconUpload } from '../../assets/svgs';
43
+ import { launchImageLibrary } from 'react-native-image-picker';
44
44
 
45
45
  export default function RegisterCamera(props: any) {
46
46
  const isFocused = useIsFocused();
@@ -191,43 +191,47 @@ export default function RegisterCamera(props: any) {
191
191
 
192
192
  const pickImageFromGallery = async () => {
193
193
  if (Platform.OS === 'android') {
194
- const granted = await PermissionsAndroid.request(
195
- PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES ||
196
- PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
197
- {
198
- title: 'Permission to access photos',
199
- message: 'App needs access to your photos to pick images.',
200
- buttonNeutral: 'Ask Me Later',
201
- buttonNegative: 'Cancel',
202
- buttonPositive: 'OK',
194
+ const result = await launchImageLibrary({
195
+ mediaType: 'photo',
196
+ });
197
+ if (result.assets) {
198
+ if (props?.route?.params?.front) {
199
+ navigation.push(ScreenNames.VehicleRegistration, {
200
+ uri: result.assets[0]?.uri,
201
+ loan: props?.route?.params?.loan,
202
+ });
203
+ } else if (props.route?.params?.callback) {
204
+ navigation.goBack();
205
+ props.route?.params?.callback(result.assets[0]?.uri);
206
+ } else {
207
+ navigation.push(ScreenNames.RegisterBack, {
208
+ uri: result.assets[0]?.uri,
209
+ loan: props?.route?.params?.loan,
210
+ });
203
211
  }
204
- );
205
-
206
- if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
207
- console.log('Permission denied');
208
- return;
209
212
  }
213
+ } else {
214
+ ImagePicker.openPicker({}).then((image) => {
215
+ if (props?.route?.params?.front) {
216
+ navigation.push(ScreenNames.VehicleRegistration, {
217
+ uri:
218
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
219
+ loan: props?.route?.params?.loan,
220
+ });
221
+ } else if (props.route?.params?.callback) {
222
+ navigation.goBack();
223
+ props.route?.params?.callback(
224
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path
225
+ );
226
+ } else {
227
+ navigation.push(ScreenNames.RegisterBack, {
228
+ uri:
229
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
230
+ loan: props?.route?.params?.loan,
231
+ });
232
+ }
233
+ });
210
234
  }
211
- ImagePicker.openPicker({}).then((image) => {
212
- if (props?.route?.params?.front) {
213
- navigation.push(ScreenNames.VehicleRegistration, {
214
- uri:
215
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
216
- loan: props?.route?.params?.loan,
217
- });
218
- } else if (props.route?.params?.callback) {
219
- navigation.goBack();
220
- props.route?.params?.callback(
221
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path
222
- );
223
- } else {
224
- navigation.push(ScreenNames.RegisterBack, {
225
- uri:
226
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
227
- loan: props?.route?.params?.loan,
228
- });
229
- }
230
- });
231
235
  };
232
236
  return (
233
237
  <View
@@ -249,7 +253,7 @@ export default function RegisterCamera(props: any) {
249
253
  <View
250
254
  style={{
251
255
  marginVertical: 16,
252
- marginTop: DeviceInfo.hasNotch() ? 70 : 0,
256
+ marginTop: DeviceInfo.hasNotch() ? 70 : 8,
253
257
  }}
254
258
  >
255
259
  <TouchableOpacity
@@ -353,7 +357,7 @@ export default function RegisterCamera(props: any) {
353
357
  <View
354
358
  style={{
355
359
  alignItems: 'center',
356
- marginVertical: 24,
360
+ marginVertical: DeviceInfo.hasNotch() ? 24 : 16,
357
361
  }}
358
362
  >
359
363
  <MButton
@@ -242,6 +242,7 @@ export default function ReviewInformation(props) {
242
242
  useEffect(() => {
243
243
  getData();
244
244
  ttsStore.getListBank();
245
+ ttsStore.getRelationship();
245
246
  }, []);
246
247
 
247
248
  return (
@@ -127,7 +127,7 @@ export default function ReviewInformationOther(props) {
127
127
  formRef.current.setFieldValue('relationshipType1', r);
128
128
  }
129
129
  if (response.data?.data?.listRelationships[1]?.relationshipType) {
130
- let r = EnumRelationshipOption2.find(
130
+ let r = ttsStore.listRelationship?.find(
131
131
  (x) =>
132
132
  x.id ===
133
133
  response.data?.data?.listRelationships[1]?.relationshipType
@@ -644,7 +644,7 @@ export default function ReviewInformationOther(props) {
644
644
  onPress={() => {
645
645
  navigation.push(ScreenNames.MSelect, {
646
646
  title: 'Mối quan hệ',
647
- data: EnumRelationshipOption2,
647
+ data: ttsStore.listRelationship,
648
648
  callback: (item) => {
649
649
  setFieldValue('relationshipType2', item);
650
650
  },
@@ -5,7 +5,6 @@ import {
5
5
  Dimensions,
6
6
  Image,
7
7
  ImageStyle,
8
- PermissionsAndroid,
9
8
  Platform,
10
9
  SafeAreaView,
11
10
  TextStyle,
@@ -40,6 +39,7 @@ import { ScreenNames } from '../../navigation';
40
39
  import { load, OCR_V2, save } from '../../utils/storage';
41
40
  import { IconUpload } from '../../assets/svgs';
42
41
  import ImagePicker from 'react-native-image-crop-picker';
42
+ import { launchImageLibrary } from 'react-native-image-picker';
43
43
 
44
44
  export default function VehicleCamera(props: any) {
45
45
  const isFocused = useIsFocused();
@@ -199,45 +199,47 @@ export default function VehicleCamera(props: any) {
199
199
 
200
200
  const pickImageFromGallery = async () => {
201
201
  if (Platform.OS === 'android') {
202
- const granted = await PermissionsAndroid.request(
203
- PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES ||
204
- PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
205
- {
206
- title: 'Permission to access photos',
207
- message: 'App needs access to your photos to pick images.',
208
- buttonNeutral: 'Ask Me Later',
209
- buttonNegative: 'Cancel',
210
- buttonPositive: 'OK',
202
+ const result = await launchImageLibrary({
203
+ mediaType: 'photo',
204
+ });
205
+ if (result.assets) {
206
+ if (props?.route?.params?.front) {
207
+ navigation.push(ScreenNames.VehicleRegistrationFront, {
208
+ uri: result.assets[0]?.uri,
209
+ loan: props?.route?.params?.loan,
210
+ });
211
+ } else if (props.route?.params?.callback) {
212
+ navigation.goBack();
213
+ props.route?.params?.callback(result.assets[0]?.uri);
214
+ } else {
215
+ navigation.push(ScreenNames.VehicleRegistrationBack, {
216
+ uri: result.assets[0]?.uri,
217
+ loan: props?.route?.params?.loan,
218
+ });
211
219
  }
212
- );
213
-
214
- if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
215
- console.log('Permission denied');
216
- return;
217
220
  }
221
+ } else {
222
+ ImagePicker.openPicker({}).then((image) => {
223
+ if (props?.route?.params?.front) {
224
+ navigation.push(ScreenNames.VehicleRegistrationFront, {
225
+ uri:
226
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
227
+ loan: props?.route?.params?.loan,
228
+ });
229
+ } else if (props.route?.params?.callback) {
230
+ navigation.goBack();
231
+ props.route?.params?.callback(
232
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path
233
+ );
234
+ } else {
235
+ navigation.push(ScreenNames.VehicleRegistrationBack, {
236
+ uri:
237
+ Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
238
+ loan: props?.route?.params?.loan,
239
+ });
240
+ }
241
+ });
218
242
  }
219
- ImagePicker.openPicker({}).then((image) => {
220
- console.log(image);
221
-
222
- if (props?.route?.params?.front) {
223
- navigation.push(ScreenNames.VehicleRegistrationFront, {
224
- uri:
225
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
226
- loan: props?.route?.params?.loan,
227
- });
228
- } else if (props.route?.params?.callback) {
229
- navigation.goBack();
230
- props.route?.params?.callback(
231
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path
232
- );
233
- } else {
234
- navigation.push(ScreenNames.VehicleRegistrationBack, {
235
- uri:
236
- Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
237
- loan: props?.route?.params?.loan,
238
- });
239
- }
240
- });
241
243
  };
242
244
 
243
245
  return (