react-native-timacare 3.3.31 → 3.3.33

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.
@@ -1,4 +1,4 @@
1
- //@ts-nocheck
1
+ // @ts-nocheck
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
3
  import { CommonActions, useNavigation } from '@react-navigation/native';
4
4
  import { Observer, observer } from 'mobx-react-lite';
@@ -14,14 +14,13 @@ import {
14
14
  View,
15
15
  } from 'react-native';
16
16
  import CircularProgress from 'react-native-circular-progress-indicator';
17
- import RNFS, { CachesDirectoryPath } from 'react-native-fs';
17
+ import RNFS from 'react-native-fs';
18
18
  import {
19
19
  PERMISSIONS,
20
20
  RESULTS,
21
21
  openSettings,
22
22
  request,
23
23
  } from 'react-native-permissions';
24
- import DeviceInfo from 'react-native-device-info';
25
24
  import { IconBackWhite, IconEkyc } from '../../assets/icons';
26
25
  import { MText } from '../../components/MText';
27
26
  import {
@@ -317,42 +316,6 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
317
316
  }
318
317
  };
319
318
 
320
- const captureFromVideo = async (uri: any) => {
321
- try {
322
- const time = new Date().getTime();
323
- const template = CachesDirectoryPath + '/' + time;
324
- const output = template + '_img_%04d.jpg';
325
- FFmpegKit.execute(`-i ${uri} -r 2 ${output}`).then(async (result) => {
326
- console.log(`FFmpeg process exited with rc=${result}.`);
327
- const returnCode = await result.getReturnCode();
328
- if (ReturnCode.isSuccess(returnCode)) {
329
- uploadLiveness(template);
330
- } else {
331
- setIsLoading(false);
332
- Alert.alert('Thông báo', 'Quá trình xử lý hình ảnh thất bại', [
333
- {
334
- text: 'Thử lại',
335
- onPress: () => {
336
- startLiveness();
337
- },
338
- },
339
- ]);
340
- }
341
- });
342
- } catch (error) {
343
- setIsLoading(false);
344
- console.log(error);
345
- Alert.alert('Thông báo', 'Quá trình xử lý hình ảnh thất bại', [
346
- {
347
- text: 'Thử lại',
348
- onPress: () => {
349
- startLiveness();
350
- },
351
- },
352
- ]);
353
- }
354
- };
355
-
356
319
  const startLiveness = async () => {
357
320
  livenessStore.ekycSuccess = false;
358
321
  if (livenessStore.listAction.length === 0) {
@@ -370,6 +333,7 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
370
333
  }
371
334
  }, 3500);
372
335
  cameraRef.current.startRecording({
336
+ fileType: 'mp4',
373
337
  videoCodec: Platform.OS === 'ios' ? 'h264' : undefined,
374
338
  onRecordingFinished: (video) => {
375
339
  clearTimeout(timeout);
@@ -383,12 +347,9 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
383
347
  });
384
348
  if (data.path) {
385
349
  setIsLoading(true);
386
- const newPath =
387
- CachesDirectoryPath + '/' + new Date().getTime() + '.mp4';
388
- await RNFS.copyFile(data.path, newPath).then(() => {
389
- console.log('Copied to:', newPath);
390
- });
391
- const thump = await extractFramesFromVideo(data.path);
350
+ const thump = await extractFramesFromVideo(
351
+ Platform.OS === 'ios' ? data.path : 'file://' + data.path
352
+ );
392
353
  if (thump.length > 0) {
393
354
  uploadLiveness(thump);
394
355
  }
@@ -509,10 +470,6 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
509
470
 
510
471
  <View style={styles.circularProgress}>
511
472
  <CircularProgress
512
- // dashedStrokeConfig={{
513
- // count: 100,
514
- // width: 7,
515
- // }}
516
473
  value={
517
474
  livenessStore.listAction.length === 3
518
475
  ? 0