react-native-timacare 3.3.11 → 3.3.13
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.
- package/lib/commonjs/RNTimacare.js +1 -1
- package/lib/commonjs/RNTimacare.js.flow +2 -11
- package/lib/commonjs/RNTimacare.js.map +1 -1
- package/lib/commonjs/assets/digital_topup/index.js +2 -0
- package/lib/commonjs/assets/digital_topup/index.js.flow +28 -0
- package/lib/commonjs/assets/digital_topup/index.js.map +1 -0
- package/lib/commonjs/assets/digital_topup/step1.svg +31 -0
- package/lib/commonjs/assets/digital_topup/step1_disable.svg +31 -0
- package/lib/commonjs/assets/digital_topup/step1_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step2.svg +39 -0
- package/lib/commonjs/assets/digital_topup/step2_disable.svg +16 -0
- package/lib/commonjs/assets/digital_topup/step2_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step3.svg +23 -0
- package/lib/commonjs/assets/digital_topup/step3_disable.svg +10 -0
- package/lib/commonjs/assets/digital_topup/step3_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step4_disable.svg +16 -0
- package/lib/commonjs/assets/digital_topup/step4_success.svg +21 -0
- package/lib/commonjs/components/AlertLoan.js +1 -1
- package/lib/commonjs/components/AlertLoan.js.flow +1 -1
- package/lib/commonjs/components/AlertLoan.js.map +1 -1
- package/lib/commonjs/components/ItemTimaOneV3.js +1 -1
- package/lib/commonjs/components/ItemTimaOneV3.js.flow +1 -5
- package/lib/commonjs/components/ItemTimaOneV3.js.map +1 -1
- package/lib/commonjs/components/MHeader.js +1 -1
- package/lib/commonjs/components/MHeader.js.flow +3 -2
- package/lib/commonjs/components/MHeader.js.map +1 -1
- package/lib/commonjs/components/ModalOptionLoan.js +1 -1
- package/lib/commonjs/components/ModalOptionLoan.js.flow +4 -2
- package/lib/commonjs/components/ModalOptionLoan.js.map +1 -1
- package/lib/commonjs/components/ModalOptionLoanDigital.js +2 -0
- package/lib/commonjs/components/ModalOptionLoanDigital.js.flow +297 -0
- package/lib/commonjs/components/ModalOptionLoanDigital.js.map +1 -0
- package/lib/commonjs/navigation/primary-navigator.js +1 -1
- package/lib/commonjs/navigation/primary-navigator.js.flow +0 -3
- package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +299 -126
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -1
- package/lib/commonjs/screens/detail-loan/QrPayment.js +1 -1
- package/lib/commonjs/screens/detail-loan/QrPayment.js.flow +1 -0
- package/lib/commonjs/screens/detail-loan/QrPayment.js.map +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.flow +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/commonjs/screens/home/DigitalTopupItem.js +2 -0
- package/lib/commonjs/screens/home/DigitalTopupItem.js.flow +562 -0
- package/lib/commonjs/screens/home/DigitalTopupItem.js.map +1 -0
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +49 -4
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/liveness-v2/index.js +1 -1
- package/lib/commonjs/screens/liveness-v2/index.js.flow +12 -9
- package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
- package/lib/commonjs/screens/nationalID/index.js +1 -1
- package/lib/commonjs/screens/nationalID/index.js.flow +4 -2
- package/lib/commonjs/screens/nationalID/index.js.map +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js.flow +3 -1
- package/lib/commonjs/screens/nationalIDBack/index.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +3 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.flow +1 -375
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.flow +12 -9
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +16 -10
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.flow +18 -15
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.flow +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +8 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.flow +20 -17
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.flow +14 -9
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js.flow +109 -61
- package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js.flow +4 -4
- package/lib/commonjs/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/commonjs/sdkConfig.js +1 -1
- package/lib/commonjs/sdkConfig.js.flow +6 -0
- package/lib/commonjs/sdkConfig.js.map +1 -1
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +32 -0
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/RNTimacare.js +1 -1
- package/lib/module/RNTimacare.js.map +1 -1
- package/lib/module/assets/digital_topup/index.js +2 -0
- package/lib/module/assets/digital_topup/index.js.map +1 -0
- package/lib/module/assets/digital_topup/step1.svg +31 -0
- package/lib/module/assets/digital_topup/step1_disable.svg +31 -0
- package/lib/module/assets/digital_topup/step1_success.svg +21 -0
- package/lib/module/assets/digital_topup/step2.svg +39 -0
- package/lib/module/assets/digital_topup/step2_disable.svg +16 -0
- package/lib/module/assets/digital_topup/step2_success.svg +21 -0
- package/lib/module/assets/digital_topup/step3.svg +23 -0
- package/lib/module/assets/digital_topup/step3_disable.svg +10 -0
- package/lib/module/assets/digital_topup/step3_success.svg +21 -0
- package/lib/module/assets/digital_topup/step4_disable.svg +16 -0
- package/lib/module/assets/digital_topup/step4_success.svg +21 -0
- package/lib/module/components/AlertLoan.js +1 -1
- package/lib/module/components/AlertLoan.js.map +1 -1
- package/lib/module/components/ItemTimaOneV3.js +1 -1
- package/lib/module/components/ItemTimaOneV3.js.map +1 -1
- package/lib/module/components/MHeader.js +1 -1
- package/lib/module/components/MHeader.js.map +1 -1
- package/lib/module/components/ModalOptionLoan.js +1 -1
- package/lib/module/components/ModalOptionLoan.js.map +1 -1
- package/lib/module/components/ModalOptionLoanDigital.js +2 -0
- package/lib/module/components/ModalOptionLoanDigital.js.map +1 -0
- package/lib/module/navigation/primary-navigator.js +1 -1
- package/lib/module/navigation/primary-navigator.js.map +1 -1
- package/lib/module/screens/camera/CCCDCameraScreen.js +1 -1
- package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -1
- package/lib/module/screens/detail-loan/QrPayment.js +1 -1
- package/lib/module/screens/detail-loan/QrPayment.js.map +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/module/screens/home/DigitalTopupItem.js +2 -0
- package/lib/module/screens/home/DigitalTopupItem.js.map +1 -0
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/liveness-v2/index.js +1 -1
- package/lib/module/screens/liveness-v2/index.js.map +1 -1
- package/lib/module/screens/nationalID/index.js +1 -1
- package/lib/module/screens/nationalID/index.js.map +1 -1
- package/lib/module/screens/nationalIDBack/index.js +1 -1
- package/lib/module/screens/nationalIDBack/index.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
- package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSignLoan.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistration.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
- package/lib/module/screens/uploadVideo/index.js +1 -1
- package/lib/module/screens/uploadVideo/index.js.map +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/module/sdkConfig.js +1 -1
- package/lib/module/sdkConfig.js.map +1 -1
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/RNTimacare.d.ts +1 -1
- package/lib/typescript/RNTimacare.d.ts.map +1 -1
- package/lib/typescript/assets/digital_topup/index.d.ts +14 -0
- package/lib/typescript/assets/digital_topup/index.d.ts.map +1 -0
- package/lib/typescript/components/ItemTimaOneV3.d.ts.map +1 -1
- package/lib/typescript/components/MHeader.d.ts.map +1 -1
- package/lib/typescript/components/ModalOptionLoan.d.ts.map +1 -1
- package/lib/typescript/components/ModalOptionLoanDigital.d.ts +9 -0
- package/lib/typescript/components/ModalOptionLoanDigital.d.ts.map +1 -0
- package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
- package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -1
- package/lib/typescript/screens/detail-loan/QrPayment.d.ts.map +1 -1
- package/lib/typescript/screens/home/DigitalTopupItem.d.ts +7 -0
- package/lib/typescript/screens/home/DigitalTopupItem.d.ts.map +1 -0
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalID/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalIDBack/index.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/ReviewLoan.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSNationalIDFront.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSSignLoan.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleRegistration.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleRegistrationFront.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
- package/lib/typescript/sdkConfig.d.ts.map +1 -1
- package/lib/typescript/services/api/api.d.ts +32 -0
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/RNTimacare.tsx +2 -11
- package/src/assets/digital_topup/index.tsx +28 -0
- package/src/assets/digital_topup/step1.svg +31 -0
- package/src/assets/digital_topup/step1_disable.svg +31 -0
- package/src/assets/digital_topup/step1_success.svg +21 -0
- package/src/assets/digital_topup/step2.svg +39 -0
- package/src/assets/digital_topup/step2_disable.svg +16 -0
- package/src/assets/digital_topup/step2_success.svg +21 -0
- package/src/assets/digital_topup/step3.svg +23 -0
- package/src/assets/digital_topup/step3_disable.svg +10 -0
- package/src/assets/digital_topup/step3_success.svg +21 -0
- package/src/assets/digital_topup/step4_disable.svg +16 -0
- package/src/assets/digital_topup/step4_success.svg +21 -0
- package/src/components/AlertLoan.tsx +1 -1
- package/src/components/ItemTimaOneV3.tsx +1 -5
- package/src/components/MHeader.tsx +3 -2
- package/src/components/ModalOptionLoan.tsx +4 -2
- package/src/components/ModalOptionLoanDigital.tsx +297 -0
- package/src/navigation/primary-navigator.tsx +0 -3
- package/src/screens/camera/CCCDCameraScreen.tsx +299 -126
- package/src/screens/detail-loan/QrPayment.tsx +1 -0
- package/src/screens/detail-loan/ShowQrCode.tsx +1 -1
- package/src/screens/home/DigitalTopupItem.tsx +562 -0
- package/src/screens/home/index.tsx +49 -4
- package/src/screens/liveness-v2/index.tsx +12 -9
- package/src/screens/nationalID/index.tsx +4 -2
- package/src/screens/nationalIDBack/index.tsx +3 -1
- package/src/screens/toan-trinh-so/OCR.tsx +3 -1
- package/src/screens/toan-trinh-so/ReviewLoan.tsx +1 -375
- package/src/screens/toan-trinh-so/TTSNationalIDFront.tsx +12 -9
- package/src/screens/toan-trinh-so/TTSSelfie.tsx +16 -10
- package/src/screens/toan-trinh-so/TTSSignLoan.tsx +18 -15
- package/src/screens/toan-trinh-so/TopupLoanInfo.tsx +1 -1
- package/src/screens/toan-trinh-so/VehicleCamera.tsx +8 -1
- package/src/screens/toan-trinh-so/VehicleRegistration.tsx +20 -17
- package/src/screens/toan-trinh-so/VehicleRegistrationFront.tsx +14 -9
- package/src/screens/uploadVideo/index.tsx +109 -61
- package/src/screens/uploadVideo/videoStore.tsx +4 -4
- package/src/sdkConfig.ts +6 -0
- package/src/services/api/api.ts +32 -0
|
@@ -40,18 +40,23 @@ export default function VehicleRegistrationFront(props: any) {
|
|
|
40
40
|
const [photo, setPhoto] = useState(null);
|
|
41
41
|
const [isLoading, setIsLoading] = useState(false);
|
|
42
42
|
|
|
43
|
-
useEffect(
|
|
43
|
+
useEffect(() => {
|
|
44
44
|
if (props?.route?.params?.uri) {
|
|
45
45
|
setPhoto(props?.route?.params?.uri);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
|
|
48
|
+
const trackStarted = async () => {
|
|
49
|
+
await logEvent('dangky_started', {
|
|
50
|
+
event: 'dangky_started',
|
|
51
|
+
createdAt: new Date(),
|
|
52
|
+
deviceId: appStore.deviceId,
|
|
53
|
+
loanId: String(props?.route?.params?.loan?.id),
|
|
54
|
+
utmSource: props?.route?.params?.loan?.utmSource,
|
|
55
|
+
});
|
|
56
|
+
logEventFb('dangky_started');
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
trackStarted();
|
|
55
60
|
}, []);
|
|
56
61
|
|
|
57
62
|
const takePhoto = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
|
-
import { observer
|
|
3
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
Alert,
|
|
6
6
|
Platform,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { formatDDMMYYY, formatMoney } from '../../utils';
|
|
13
13
|
import { RNCamera } from 'react-native-camera';
|
|
14
14
|
import MButton from '../../components/MButton';
|
|
15
|
-
import {
|
|
15
|
+
import { IconPause, IconPlay } from '../../assets/icons';
|
|
16
16
|
import { MText } from '../../components/MText';
|
|
17
17
|
import { useNavigation } from '@react-navigation/native';
|
|
18
18
|
import videoStore from './videoStore';
|
|
@@ -21,89 +21,137 @@ import {
|
|
|
21
21
|
requestMultiple,
|
|
22
22
|
openSettings,
|
|
23
23
|
PERMISSIONS,
|
|
24
|
-
request,
|
|
25
24
|
RESULTS,
|
|
26
25
|
} from 'react-native-permissions';
|
|
27
26
|
import Loading from '../../components/Loading';
|
|
28
27
|
import MHeader from '../../components/MHeader';
|
|
29
28
|
|
|
29
|
+
const COUNTDOWN_SECONDS = 3;
|
|
30
|
+
|
|
31
|
+
const getCameraPermissions = () =>
|
|
32
|
+
Platform.OS === 'ios'
|
|
33
|
+
? [PERMISSIONS.IOS.CAMERA, PERMISSIONS.IOS.MICROPHONE]
|
|
34
|
+
: [PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.ANDROID.RECORD_AUDIO];
|
|
35
|
+
|
|
30
36
|
export const Video = observer(function Video(props: any) {
|
|
31
37
|
const navigation = useNavigation();
|
|
32
38
|
const camera = useRef(null);
|
|
33
|
-
const [count, setCount] = useState(
|
|
34
|
-
const
|
|
35
|
-
const [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const content =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const requestPermissions = () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
39
|
+
const [count, setCount] = useState(COUNTDOWN_SECONDS);
|
|
40
|
+
const [isRecording, setIsRecording] = useState(false);
|
|
41
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
42
|
+
|
|
43
|
+
const loan = props?.route?.params?.loan;
|
|
44
|
+
const content = useMemo(() => {
|
|
45
|
+
return `Hôm nay ngày ${formatDDMMYYY(new Date())} tôi tên là ${
|
|
46
|
+
loan?.fullname || ''
|
|
47
|
+
} có thực hiện khoản vay tại Tima với số tiền là ${formatMoney(
|
|
48
|
+
loan?.loanAmount || 0
|
|
49
|
+
)}`;
|
|
50
|
+
}, [loan?.fullname, loan?.loanAmount]);
|
|
51
|
+
|
|
52
|
+
const requestPermissions = async () => {
|
|
53
|
+
const permissions = getCameraPermissions();
|
|
54
|
+
const statuses = await checkMultiple(permissions);
|
|
55
|
+
const toRequest = permissions.filter(
|
|
56
|
+
(permission) => statuses[permission] !== RESULTS.GRANTED
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (toRequest.length === 0) return true;
|
|
60
|
+
|
|
61
|
+
const requested = await requestMultiple(toRequest);
|
|
62
|
+
const values = Object.values(requested);
|
|
63
|
+
const allGranted = values.every((status) => status === RESULTS.GRANTED);
|
|
64
|
+
const anyBlocked = values.some((status) => status === RESULTS.BLOCKED);
|
|
65
|
+
|
|
66
|
+
if (!allGranted) {
|
|
67
|
+
Alert.alert(
|
|
68
|
+
'Thông báo',
|
|
69
|
+
anyBlocked
|
|
70
|
+
? 'Vui lòng bật quyền Camera và Micro trong Cài đặt để tiếp tục.'
|
|
71
|
+
: 'Vui lòng cấp quyền Camera và Micro để tiếp tục.',
|
|
72
|
+
anyBlocked
|
|
73
|
+
? [
|
|
74
|
+
{ text: 'Huỷ' },
|
|
75
|
+
{
|
|
76
|
+
text: 'Mở cài đặt',
|
|
77
|
+
onPress: () => openSettings(),
|
|
78
|
+
},
|
|
79
|
+
]
|
|
80
|
+
: [{ text: 'OK' }]
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return allGranted;
|
|
52
85
|
};
|
|
53
86
|
|
|
54
87
|
useEffect(() => {
|
|
55
88
|
requestPermissions();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
setCount(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
89
|
+
setCount(COUNTDOWN_SECONDS);
|
|
90
|
+
const id = setInterval(() => {
|
|
91
|
+
setCount((prev) => {
|
|
92
|
+
if (prev <= 1) {
|
|
93
|
+
clearInterval(id);
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
return prev - 1;
|
|
97
|
+
});
|
|
62
98
|
}, 1000);
|
|
99
|
+
return () => clearInterval(id);
|
|
63
100
|
}, []);
|
|
64
101
|
|
|
65
102
|
const stopRecording = () => {
|
|
103
|
+
if (!camera.current) return;
|
|
66
104
|
camera.current.stopRecording();
|
|
67
105
|
setIsRecording(false);
|
|
68
|
-
setIsLoading(true);
|
|
69
106
|
};
|
|
70
107
|
|
|
71
108
|
const startVideo = async () => {
|
|
72
|
-
if (!camera) {
|
|
109
|
+
if (!camera.current || isLoading || isRecording || count > 0) {
|
|
73
110
|
return;
|
|
74
111
|
}
|
|
112
|
+
const hasPermission = await requestPermissions();
|
|
113
|
+
if (!hasPermission) return;
|
|
114
|
+
|
|
75
115
|
setIsRecording(true);
|
|
76
|
-
|
|
77
|
-
|
|
116
|
+
try {
|
|
117
|
+
const data = await camera.current.recordAsync({
|
|
78
118
|
quality: RNCamera.Constants.VideoQuality['480p'],
|
|
79
119
|
videoBitrate: 1500000,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
...(Platform.OS === 'ios'
|
|
121
|
+
? { codec: RNCamera.Constants.VideoCodec.H264 }
|
|
122
|
+
: {}),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
setIsLoading(true);
|
|
126
|
+
const formData = new FormData();
|
|
127
|
+
formData.append('video', {
|
|
128
|
+
name: data.uri.split(/[\\/]/).pop(),
|
|
129
|
+
uri: data.uri,
|
|
130
|
+
type: 'video/*',
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
videoStore.uploadVideo(
|
|
134
|
+
loan?.id,
|
|
135
|
+
formData,
|
|
136
|
+
() => {
|
|
137
|
+
setIsLoading(false);
|
|
138
|
+
Alert.alert('Thông báo', 'Tải video lên thành công', [
|
|
139
|
+
{
|
|
140
|
+
text: 'Ok',
|
|
141
|
+
onPress: () => navigation.goBack(),
|
|
142
|
+
},
|
|
143
|
+
]);
|
|
144
|
+
},
|
|
145
|
+
() => {
|
|
146
|
+
setIsLoading(false);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
setIsRecording(false);
|
|
151
|
+
setIsLoading(false);
|
|
152
|
+
console.error(err);
|
|
153
|
+
Alert.alert('Thông báo', 'Không thể quay video. Vui lòng thử lại.');
|
|
154
|
+
}
|
|
107
155
|
};
|
|
108
156
|
|
|
109
157
|
return (
|
|
@@ -143,7 +191,7 @@ export const Video = observer(function Video(props: any) {
|
|
|
143
191
|
<RNCamera
|
|
144
192
|
ref={camera}
|
|
145
193
|
style={styles.preview}
|
|
146
|
-
type=
|
|
194
|
+
type={RNCamera.Constants.Type.front}
|
|
147
195
|
permissionDialogTitle={'Permission to use camera'}
|
|
148
196
|
permissionDialogMessage={
|
|
149
197
|
'We need your permission to use your camera phone'
|
|
@@ -8,11 +8,9 @@ class Store {
|
|
|
8
8
|
|
|
9
9
|
@action
|
|
10
10
|
async uploadVideo(loanID, body, onSuccess?, onError) {
|
|
11
|
+
this.isLoading = true;
|
|
11
12
|
try {
|
|
12
|
-
this.isLoading = true;
|
|
13
13
|
const response = await Api.getInstance().uploadVideo(loanID, body);
|
|
14
|
-
console.log(response);
|
|
15
|
-
this.isLoading = false;
|
|
16
14
|
if (response.kind === 'ok') {
|
|
17
15
|
if (response.data.meta.errorCode === 200) {
|
|
18
16
|
if (onSuccess) onSuccess();
|
|
@@ -21,13 +19,15 @@ class Store {
|
|
|
21
19
|
if (onError) onError();
|
|
22
20
|
}
|
|
23
21
|
} else {
|
|
24
|
-
this.isLoading = false;
|
|
25
22
|
Alert.alert('Thông báo', 'Lỗi đã xảy ra. Vui lòng thực hiện lại');
|
|
26
23
|
if (onError) onError();
|
|
27
24
|
}
|
|
28
25
|
} catch (error) {
|
|
29
26
|
console.log(error);
|
|
27
|
+
Alert.alert('Thông báo', 'Lỗi đã xảy ra. Vui lòng thực hiện lại');
|
|
30
28
|
if (onError) onError();
|
|
29
|
+
} finally {
|
|
30
|
+
this.isLoading = false;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/sdkConfig.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import appStore from "./AppStore";
|
|
2
|
+
|
|
1
3
|
export type SDKConfig = {
|
|
2
4
|
baseUrl: string;
|
|
3
5
|
token?: string;
|
|
@@ -7,6 +9,10 @@ let config: SDKConfig | null = null;
|
|
|
7
9
|
|
|
8
10
|
export const initSDK = (options: SDKConfig) => {
|
|
9
11
|
config = options;
|
|
12
|
+
appStore.getDeviceId();
|
|
13
|
+
appStore.getPublicIp();
|
|
14
|
+
appStore.getAppId();
|
|
15
|
+
appStore.getDevicePayload();
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
export const getSDKConfig = (): SDKConfig => {
|
package/src/services/api/api.ts
CHANGED
|
@@ -3279,4 +3279,36 @@ export class Api {
|
|
|
3279
3279
|
return { kind: "bad-data" }
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
|
+
|
|
3283
|
+
async getSuggestDigitalTopup(id) {
|
|
3284
|
+
// make the api call
|
|
3285
|
+
const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/autodev2/digital_topup_get_product_suggerst?loanBriefId=${id}`)
|
|
3286
|
+
// the typical ways to die when calling an api
|
|
3287
|
+
if (!response.ok) {
|
|
3288
|
+
const problem = getGeneralApiProblem(response)
|
|
3289
|
+
if (problem) return problem
|
|
3290
|
+
}
|
|
3291
|
+
// transform the data into the format we are expecting
|
|
3292
|
+
try {
|
|
3293
|
+
return { kind: "ok", data: response.data }
|
|
3294
|
+
} catch {
|
|
3295
|
+
return { kind: "bad-data" }
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
async updateDigitalProductLoan(body) {
|
|
3300
|
+
// make the api call
|
|
3301
|
+
const response: ApiResponse<any> = await this.apisauce.post(`api/v2.0/autodev2/digital_topup_update_product`, body)
|
|
3302
|
+
// the typical ways to die when calling an api
|
|
3303
|
+
if (!response.ok) {
|
|
3304
|
+
const problem = getGeneralApiProblem(response)
|
|
3305
|
+
if (problem) return problem
|
|
3306
|
+
}
|
|
3307
|
+
// transform the data into the format we are expecting
|
|
3308
|
+
try {
|
|
3309
|
+
return { kind: "ok", data: response.data }
|
|
3310
|
+
} catch {
|
|
3311
|
+
return { kind: "bad-data" }
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3282
3314
|
}
|