@trustchex/react-native-sdk 1.381.0 → 1.464.0
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/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKModule.kt +2 -8
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +60 -13
- package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +1 -1
- package/ios/Camera/TrustchexCameraView.swift +10 -13
- package/ios/MLKit/MLKitModule.swift +1 -1
- package/lib/module/Screens/Debug/BarcodeTestScreen.js +308 -0
- package/lib/module/Screens/Debug/MRZTestScreen.js +105 -13
- package/lib/module/Screens/Debug/NFCScanTestScreen.js +635 -0
- package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +49 -32
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +22 -4
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +5 -0
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +126 -27
- package/lib/module/Screens/Dynamic/VerbalConsentScreen.js +1079 -0
- package/lib/module/Screens/Dynamic/VideoCallScreen.js +678 -0
- package/lib/module/Screens/Static/OTPVerificationScreen.js +6 -0
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +7 -1
- package/lib/module/Screens/Static/ResultScreen.js +154 -34
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +59 -51
- package/lib/module/Shared/Animations/recording.json +1 -0
- package/lib/module/Shared/Animations/video-call.json +1 -0
- package/lib/module/Shared/Components/DebugNavigationPanel.js +231 -67
- package/lib/module/Shared/Components/EIDScanner.js +213 -112
- package/lib/module/Shared/Components/IdentityDocumentCamera.flows.js +5 -3
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +77 -39
- package/lib/module/Shared/Components/IdentityDocumentCamera.utils.js +13 -4
- package/lib/module/Shared/Components/NavigationManager.js +39 -19
- package/lib/module/Shared/Contexts/AppContext.js +1 -0
- package/lib/module/Shared/EIDReader/aesSecureMessagingWrapper.js +51 -0
- package/lib/module/Shared/EIDReader/apduLevelPACECapable.js +3 -0
- package/lib/module/Shared/EIDReader/bacKey.js +16 -2
- package/lib/module/Shared/EIDReader/eidReader.js +354 -13
- package/lib/module/Shared/EIDReader/eidService.js +25 -1
- package/lib/module/Shared/EIDReader/nfcManagerCardService.js +4 -7
- package/lib/module/Shared/EIDReader/paceInfo.js +85 -0
- package/lib/module/Shared/EIDReader/paceKeySpec.js +51 -0
- package/lib/module/Shared/EIDReader/protocol/paceAPDUSender.js +100 -0
- package/lib/module/Shared/EIDReader/protocol/paceProtocol.js +655 -0
- package/lib/module/Shared/EIDReader/protocol/paceResult.js +37 -0
- package/lib/module/Shared/EIDReader/secureMessagingWrapper.js +27 -4
- package/lib/module/Shared/EIDReader/smartcards/commandAPDU.js +2 -1
- package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +1 -1
- package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +6 -3
- package/lib/module/Shared/EIDReader/utils/aesCrypto.utils.js +189 -0
- package/lib/module/Shared/Libs/SignalingClient.js +128 -0
- package/lib/module/Shared/Libs/analytics.utils.js +8 -0
- package/lib/module/Shared/Libs/contains.js +1 -40
- package/lib/module/Shared/Libs/country-display.utils.js +34 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +9 -1
- package/lib/module/Shared/Libs/demo.utils.js +8 -0
- package/lib/module/Shared/Libs/http-client.js +9 -0
- package/lib/module/Shared/Libs/mrz.utils.js +3 -2
- package/lib/module/Shared/Libs/promise.utils.js +16 -2
- package/lib/module/Shared/Libs/status-bar.utils.js +23 -0
- package/lib/module/Shared/Services/DataUploadService.js +294 -0
- package/lib/module/Shared/Services/VideoSessionService.js +156 -0
- package/lib/module/Shared/Services/WebRTCService.js +510 -0
- package/lib/module/Shared/Types/analytics.types.js +4 -0
- package/lib/module/Translation/Resources/en.js +61 -2
- package/lib/module/Translation/Resources/tr.js +61 -2
- package/lib/module/Trustchex.js +64 -20
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Debug/MRZTestScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts +5 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +1 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts +18 -0
- package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts +23 -0
- package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts +6 -0
- package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts +9 -0
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts +50 -0
- package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts +30 -0
- package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts +17 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts +105 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts +24 -0
- package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts +15 -0
- package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts +39 -0
- package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts +24 -0
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/contains.d.ts +0 -7
- package/lib/typescript/src/Shared/Libs/contains.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts +2 -0
- package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/promise.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts +9 -0
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts +25 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts +33 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts +58 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts +4 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +13 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/en.d.ts +60 -1
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts +60 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +35 -5
- package/src/Screens/Debug/BarcodeTestScreen.tsx +317 -0
- package/src/Screens/Debug/MRZTestScreen.tsx +107 -13
- package/src/Screens/Debug/NFCScanTestScreen.tsx +692 -0
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +58 -35
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +27 -4
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +6 -0
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +156 -27
- package/src/Screens/Dynamic/VerbalConsentScreen.tsx +1401 -0
- package/src/Screens/Dynamic/VideoCallScreen.tsx +766 -0
- package/src/Screens/Static/OTPVerificationScreen.tsx +6 -0
- package/src/Screens/Static/QrCodeScanningScreen.tsx +7 -1
- package/src/Screens/Static/ResultScreen.tsx +235 -48
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +67 -72
- package/src/Shared/Animations/recording.json +1 -0
- package/src/Shared/Animations/video-call.json +1 -0
- package/src/Shared/Components/DebugNavigationPanel.tsx +252 -51
- package/src/Shared/Components/EIDScanner.tsx +223 -116
- package/src/Shared/Components/IdentityDocumentCamera.flows.ts +7 -4
- package/src/Shared/Components/IdentityDocumentCamera.tsx +224 -188
- package/src/Shared/Components/IdentityDocumentCamera.utils.ts +13 -4
- package/src/Shared/Components/NavigationManager.tsx +41 -19
- package/src/Shared/Contexts/AppContext.ts +2 -0
- package/src/Shared/EIDReader/aesSecureMessagingWrapper.ts +69 -0
- package/src/Shared/EIDReader/apduLevelPACECapable.ts +34 -0
- package/src/Shared/EIDReader/bacKey.ts +24 -8
- package/src/Shared/EIDReader/eidReader.ts +398 -12
- package/src/Shared/EIDReader/eidService.ts +49 -1
- package/src/Shared/EIDReader/nfcManagerCardService.ts +4 -6
- package/src/Shared/EIDReader/paceInfo.ts +159 -0
- package/src/Shared/EIDReader/paceKeySpec.ts +56 -0
- package/src/Shared/EIDReader/protocol/paceAPDUSender.ts +163 -0
- package/src/Shared/EIDReader/protocol/paceProtocol.ts +946 -0
- package/src/Shared/EIDReader/protocol/paceResult.ts +62 -0
- package/src/Shared/EIDReader/secureMessagingWrapper.ts +28 -10
- package/src/Shared/EIDReader/smartcards/commandAPDU.ts +2 -1
- package/src/Shared/EIDReader/tlv/tlv.helpers.ts +1 -1
- package/src/Shared/EIDReader/tlv/tlv.utils.ts +8 -5
- package/src/Shared/EIDReader/utils/aesCrypto.utils.ts +217 -0
- package/src/Shared/Libs/SignalingClient.ts +189 -0
- package/src/Shared/Libs/analytics.utils.ts +8 -0
- package/src/Shared/Libs/contains.ts +0 -53
- package/src/Shared/Libs/country-display.utils.ts +55 -0
- package/src/Shared/Libs/crypto.utils.ts +2 -2
- package/src/Shared/Libs/deeplink.utils.ts +12 -1
- package/src/Shared/Libs/demo.utils.ts +10 -0
- package/src/Shared/Libs/http-client.ts +19 -1
- package/src/Shared/Libs/mrz.utils.ts +3 -2
- package/src/Shared/Libs/promise.utils.ts +16 -2
- package/src/Shared/Libs/status-bar.utils.ts +21 -0
- package/src/Shared/Services/DataUploadService.ts +395 -0
- package/src/Shared/Services/VideoSessionService.ts +190 -0
- package/src/Shared/Services/WebRTCService.ts +636 -0
- package/src/Shared/Types/analytics.types.ts +4 -0
- package/src/Shared/Types/identificationInfo.ts +16 -1
- package/src/Translation/Resources/en.ts +88 -3
- package/src/Translation/Resources/tr.ts +89 -3
- package/src/Trustchex.tsx +65 -19
- package/src/version.ts +1 -1
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState, useRef, useContext } from 'react';
|
|
4
|
+
import { Dimensions, Platform, StyleSheet, Text, TouchableOpacity, View, ActivityIndicator, PermissionsAndroid, StatusBar } from 'react-native';
|
|
5
|
+
import { RTCView } from 'react-native-webrtc';
|
|
6
|
+
import InCallManager from 'react-native-incall-manager';
|
|
7
|
+
import LottieView from 'lottie-react-native';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { useStatusBarWhiteBackground } from "../../Shared/Libs/status-bar.utils.js";
|
|
10
|
+
import { WebRTCService } from "../../Shared/Services/WebRTCService.js";
|
|
11
|
+
import { VideoSessionService } from "../../Shared/Services/VideoSessionService.js";
|
|
12
|
+
import { DataUploadService } from "../../Shared/Services/DataUploadService.js";
|
|
13
|
+
import AppContext from "../../Shared/Contexts/AppContext.js";
|
|
14
|
+
import NavigationManager from "../../Shared/Components/NavigationManager.js";
|
|
15
|
+
import StyledButton from "../../Shared/Components/StyledButton.js";
|
|
16
|
+
import { trackVerificationStart, trackVerificationComplete } from "../../Shared/Libs/analytics.utils.js";
|
|
17
|
+
import { useKeepAwake } from "../../Shared/Libs/native-keep-awake.utils.js";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const {
|
|
20
|
+
width,
|
|
21
|
+
height
|
|
22
|
+
} = Dimensions.get('window');
|
|
23
|
+
const VideoCallScreen = ({
|
|
24
|
+
navigation
|
|
25
|
+
}) => {
|
|
26
|
+
useKeepAwake();
|
|
27
|
+
const appContext = useContext(AppContext);
|
|
28
|
+
const {
|
|
29
|
+
baseUrl,
|
|
30
|
+
identificationInfo,
|
|
31
|
+
onError
|
|
32
|
+
} = appContext;
|
|
33
|
+
const {
|
|
34
|
+
t
|
|
35
|
+
} = useTranslation();
|
|
36
|
+
|
|
37
|
+
// Configure status bar for white background
|
|
38
|
+
useStatusBarWhiteBackground();
|
|
39
|
+
const [hasGuideShown, setHasGuideShown] = useState(false);
|
|
40
|
+
const [localStream, setLocalStream] = useState(null);
|
|
41
|
+
const [remoteStream, setRemoteStream] = useState(null);
|
|
42
|
+
const [connectionState, setConnectionState] = useState('connecting');
|
|
43
|
+
const [queuePosition, setQueuePosition] = useState(null);
|
|
44
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
45
|
+
const [showLeaveButton, setShowLeaveButton] = useState(false);
|
|
46
|
+
const [uploadStatus, setUploadStatus] = useState('pending');
|
|
47
|
+
const [agentInstructions, setAgentInstructions] = useState([]);
|
|
48
|
+
const [localStreamKey, setLocalStreamKey] = useState(0);
|
|
49
|
+
|
|
50
|
+
// Update status bar when guide visibility changes
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (hasGuideShown) {
|
|
53
|
+
// Video call view - use light icons
|
|
54
|
+
StatusBar.setBarStyle('light-content', true);
|
|
55
|
+
} else {
|
|
56
|
+
// Guide screen with white background - use dark icons
|
|
57
|
+
StatusBar.setBarStyle('dark-content', true);
|
|
58
|
+
if (Platform.OS === 'android') {
|
|
59
|
+
StatusBar.setBackgroundColor('#ffffff', true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, [hasGuideShown]);
|
|
63
|
+
const serviceRef = useRef(null);
|
|
64
|
+
const videoSessionServiceRef = useRef(null);
|
|
65
|
+
const dataUploadServiceRef = useRef(null);
|
|
66
|
+
const uploadPromiseMapRef = useRef(new Map());
|
|
67
|
+
const navigationManagerRef = useRef(null);
|
|
68
|
+
const joinedSessionIdRef = useRef(null);
|
|
69
|
+
const callConnectedRef = useRef(false);
|
|
70
|
+
const sessionEndedRef = useRef(false);
|
|
71
|
+
const handleRemoteCommand = command => {
|
|
72
|
+
switch (command.type) {
|
|
73
|
+
case 'toggleFlash':
|
|
74
|
+
serviceRef.current?.toggleFlash();
|
|
75
|
+
break;
|
|
76
|
+
case 'displayInstruction':
|
|
77
|
+
setAgentInstructions(prev => [...prev, {
|
|
78
|
+
id: command.itemId || Date.now().toString(),
|
|
79
|
+
text: command.text,
|
|
80
|
+
timestamp: Date.now()
|
|
81
|
+
}].slice(-3)); // Keep only last 3 instructions
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
// Don't initialize until guide is dismissed
|
|
87
|
+
if (!hasGuideShown) return;
|
|
88
|
+
const identificationId = identificationInfo.identificationId;
|
|
89
|
+
const verificationSessionId = identificationInfo.sessionId;
|
|
90
|
+
const existingVideoSessionId = identificationInfo.videoSessionId;
|
|
91
|
+
const hasCollectedData = !!identificationInfo.scannedDocument || !!identificationInfo.livenessDetection;
|
|
92
|
+
let mounted = true;
|
|
93
|
+
let queueUnsubscribe = null;
|
|
94
|
+
let callStartTime = null;
|
|
95
|
+
let heartbeatInterval = null;
|
|
96
|
+
let leaveButtonTimeout = null;
|
|
97
|
+
|
|
98
|
+
// Track video call started
|
|
99
|
+
trackVerificationStart('VIDEO_CALL');
|
|
100
|
+
const init = async () => {
|
|
101
|
+
if (!baseUrl) {
|
|
102
|
+
console.error('Missing base URL');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!identificationId) {
|
|
106
|
+
console.error('Missing identification ID');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Upload collected data in background (don't block video call initialization)
|
|
111
|
+
// This allows the agent to see the data during the video call
|
|
112
|
+
const uploadCollectedData = async () => {
|
|
113
|
+
const uploadKey = `${identificationId}:${verificationSessionId || ''}`;
|
|
114
|
+
|
|
115
|
+
// If upload already in progress, return the same promise
|
|
116
|
+
const existingPromise = uploadPromiseMapRef.current.get(uploadKey);
|
|
117
|
+
if (existingPromise) {
|
|
118
|
+
return existingPromise;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Create the upload promise
|
|
122
|
+
const uploadPromise = (async () => {
|
|
123
|
+
if (hasCollectedData) {
|
|
124
|
+
setUploadStatus('uploading');
|
|
125
|
+
try {
|
|
126
|
+
const uploadService = new DataUploadService(baseUrl);
|
|
127
|
+
dataUploadServiceRef.current = uploadService;
|
|
128
|
+
const uploaded = await uploadService.uploadCollectedData(identificationInfo);
|
|
129
|
+
if (!uploaded) {
|
|
130
|
+
console.warn('[VideoCallScreen] Upload service returned false');
|
|
131
|
+
if (mounted) {
|
|
132
|
+
setUploadStatus('failed');
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (mounted) {
|
|
137
|
+
setUploadStatus('done');
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error('[VideoCallScreen] Failed to upload collected data:', error);
|
|
142
|
+
if (mounted) {
|
|
143
|
+
setUploadStatus('failed');
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
} finally {
|
|
147
|
+
uploadPromiseMapRef.current.delete(uploadKey);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
setUploadStatus('done');
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
})();
|
|
154
|
+
|
|
155
|
+
// Store the promise before awaiting
|
|
156
|
+
uploadPromiseMapRef.current.set(uploadKey, uploadPromise);
|
|
157
|
+
return uploadPromise;
|
|
158
|
+
};
|
|
159
|
+
const uploadedBeforeCall = await uploadCollectedData();
|
|
160
|
+
if (hasCollectedData && !uploadedBeforeCall) {
|
|
161
|
+
if (mounted) {
|
|
162
|
+
setErrorMessage('Failed to upload verification data before video call.');
|
|
163
|
+
setConnectionState('failed');
|
|
164
|
+
}
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Fetch or create video session if videoSessionId is not available
|
|
169
|
+
let videoSessionId = existingVideoSessionId;
|
|
170
|
+
if (!videoSessionId) {
|
|
171
|
+
try {
|
|
172
|
+
// Build URL with both identificationId and verificationSessionId for better lookup.
|
|
173
|
+
// Avoid new URL() + searchParams.set — not implemented on Android Hermes.
|
|
174
|
+
let sessionUrl = `${baseUrl}/api/app/mobile/identifications/${identificationId}/video-session`;
|
|
175
|
+
if (verificationSessionId) {
|
|
176
|
+
sessionUrl += `?verificationSessionId=${encodeURIComponent(verificationSessionId)}`;
|
|
177
|
+
}
|
|
178
|
+
const response = await fetch(sessionUrl, {
|
|
179
|
+
method: 'GET',
|
|
180
|
+
headers: {
|
|
181
|
+
'Content-Type': 'application/json'
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
if (!response.ok) {
|
|
185
|
+
let errorMessage = 'Unknown error';
|
|
186
|
+
try {
|
|
187
|
+
const errorBody = await response.json();
|
|
188
|
+
errorMessage = errorBody.message || errorBody.error || response.statusText;
|
|
189
|
+
if (errorBody.details) {
|
|
190
|
+
errorMessage = `${errorMessage}: ${errorBody.details}`;
|
|
191
|
+
}
|
|
192
|
+
} catch {
|
|
193
|
+
errorMessage = response.statusText;
|
|
194
|
+
}
|
|
195
|
+
console.error('[VideoCallScreen] Server error response:', {
|
|
196
|
+
status: response.status,
|
|
197
|
+
message: errorMessage,
|
|
198
|
+
url: sessionUrl
|
|
199
|
+
});
|
|
200
|
+
throw new Error(`Failed to get video session: ${response.status} ${errorMessage}`);
|
|
201
|
+
}
|
|
202
|
+
const data = await response.json();
|
|
203
|
+
videoSessionId = data.videoSessionId;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error('[VideoCallScreen] Failed to get video session:', error);
|
|
206
|
+
if (mounted) {
|
|
207
|
+
setErrorMessage('Failed to initialize video session. Please try again.');
|
|
208
|
+
setConnectionState('failed');
|
|
209
|
+
}
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (!videoSessionId) {
|
|
214
|
+
console.error('Missing video session ID');
|
|
215
|
+
if (mounted) {
|
|
216
|
+
setErrorMessage('Unable to start video call. Please try again.');
|
|
217
|
+
setConnectionState('failed');
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Initialize video session service (mobile API is public, no auth token needed)
|
|
223
|
+
const videoSessionService = new VideoSessionService(baseUrl, identificationId);
|
|
224
|
+
videoSessionServiceRef.current = videoSessionService;
|
|
225
|
+
|
|
226
|
+
// Try to join the session
|
|
227
|
+
try {
|
|
228
|
+
await videoSessionService.joinSession(videoSessionId);
|
|
229
|
+
joinedSessionIdRef.current = videoSessionId;
|
|
230
|
+
|
|
231
|
+
// Send heartbeat every 10s while in queue
|
|
232
|
+
heartbeatInterval = setInterval(() => {
|
|
233
|
+
if (!callConnectedRef.current) {
|
|
234
|
+
videoSessionService.sendHeartbeat(videoSessionId);
|
|
235
|
+
} else {
|
|
236
|
+
clearInterval(heartbeatInterval);
|
|
237
|
+
heartbeatInterval = null;
|
|
238
|
+
}
|
|
239
|
+
}, 10_000);
|
|
240
|
+
|
|
241
|
+
// Show leave button after 60s if still waiting
|
|
242
|
+
leaveButtonTimeout = setTimeout(() => {
|
|
243
|
+
if (mounted && !callConnectedRef.current) {
|
|
244
|
+
setShowLeaveButton(true);
|
|
245
|
+
}
|
|
246
|
+
}, 60_000);
|
|
247
|
+
} catch (error) {
|
|
248
|
+
console.error('[VideoCallScreen] Failed to join session:', error);
|
|
249
|
+
if (mounted) {
|
|
250
|
+
setErrorMessage(error?.message || 'Failed to join video session');
|
|
251
|
+
setConnectionState('failed');
|
|
252
|
+
}
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Subscribe to queue updates
|
|
257
|
+
queueUnsubscribe = videoSessionService.subscribeToQueueUpdates(videoSessionId, position => {
|
|
258
|
+
if (mounted) {
|
|
259
|
+
setQueuePosition(position);
|
|
260
|
+
}
|
|
261
|
+
}, error => {
|
|
262
|
+
console.error('[VideoCallScreen] Queue update error:', error);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Initialize WebRTC service
|
|
266
|
+
const service = new WebRTCService({
|
|
267
|
+
baseUrl,
|
|
268
|
+
sessionId: videoSessionId,
|
|
269
|
+
identificationId,
|
|
270
|
+
onRemoteStream: stream => {
|
|
271
|
+
if (mounted) {
|
|
272
|
+
setRemoteStream(stream);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
onConnectionStateChange: state => {
|
|
276
|
+
if (mounted) setConnectionState(state);
|
|
277
|
+
if (state === 'connected') {
|
|
278
|
+
callConnectedRef.current = true;
|
|
279
|
+
setShowLeaveButton(false);
|
|
280
|
+
if (leaveButtonTimeout) {
|
|
281
|
+
clearTimeout(leaveButtonTimeout);
|
|
282
|
+
leaveButtonTimeout = null;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if ((state === 'failed' || state === 'closed') && callConnectedRef.current && !sessionEndedRef.current) {
|
|
286
|
+
const durationMs = callStartTime ? Date.now() - callStartTime : 0;
|
|
287
|
+
trackVerificationComplete('VIDEO_CALL', false, durationMs / 1000);
|
|
288
|
+
service.cleanup();
|
|
289
|
+
if (mounted) {
|
|
290
|
+
if (appContext.currentWorkflowStep?.required) {
|
|
291
|
+
setErrorMessage(t('videoCallScreen.callNotCompleted'));
|
|
292
|
+
setConnectionState('failed');
|
|
293
|
+
} else {
|
|
294
|
+
navigation.navigate('ResultScreen');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
onCommand: handleRemoteCommand,
|
|
300
|
+
onLocalStreamUpdate: newStream => {
|
|
301
|
+
setLocalStream(newStream);
|
|
302
|
+
setLocalStreamKey(k => k + 1);
|
|
303
|
+
},
|
|
304
|
+
onSessionEnded: state => {
|
|
305
|
+
sessionEndedRef.current = true;
|
|
306
|
+
// Track video call completed
|
|
307
|
+
const durationMs = callStartTime ? Date.now() - callStartTime : 0;
|
|
308
|
+
trackVerificationComplete('VIDEO_CALL', state === 'COMPLETED', durationMs / 1000);
|
|
309
|
+
// Always navigate to ResultScreen so data is submitted regardless of
|
|
310
|
+
// whether the agent ended the session as COMPLETED or FAILED
|
|
311
|
+
service.cleanup();
|
|
312
|
+
if (mounted) {
|
|
313
|
+
navigation.navigate('ResultScreen');
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
serviceRef.current = service;
|
|
318
|
+
|
|
319
|
+
// Request Permissions
|
|
320
|
+
if (Platform.OS === 'android') {
|
|
321
|
+
const granted = await PermissionsAndroid.requestMultiple([PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.RECORD_AUDIO]);
|
|
322
|
+
if (granted['android.permission.CAMERA'] !== PermissionsAndroid.RESULTS.GRANTED || granted['android.permission.RECORD_AUDIO'] !== PermissionsAndroid.RESULTS.GRANTED) {
|
|
323
|
+
if (mounted) setConnectionState('permissions_denied');
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// For iOS, react-native-webrtc or VisionCamera usually triggers it,
|
|
328
|
+
// but explicit request via library is better if we had one.
|
|
329
|
+
// Assuming automatic or previously granted for now.
|
|
330
|
+
|
|
331
|
+
try {
|
|
332
|
+
const stream = await service.initialize();
|
|
333
|
+
if (mounted) {
|
|
334
|
+
setLocalStream(stream);
|
|
335
|
+
callStartTime = Date.now();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Start InCallManager to route audio through speaker
|
|
339
|
+
InCallManager.start({
|
|
340
|
+
media: 'video'
|
|
341
|
+
});
|
|
342
|
+
InCallManager.setSpeakerphoneOn(true);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
console.error('[VideoCallScreen] Failed to start call', e);
|
|
345
|
+
if (mounted) setConnectionState('failed');
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
init();
|
|
349
|
+
return () => {
|
|
350
|
+
mounted = false;
|
|
351
|
+
if (heartbeatInterval) clearInterval(heartbeatInterval);
|
|
352
|
+
if (leaveButtonTimeout) clearTimeout(leaveButtonTimeout);
|
|
353
|
+
queueUnsubscribe?.();
|
|
354
|
+
// If joined but call never connected, explicitly leave to drop from queue
|
|
355
|
+
if (joinedSessionIdRef.current && !callConnectedRef.current) {
|
|
356
|
+
videoSessionServiceRef.current?.leaveSession(joinedSessionIdRef.current);
|
|
357
|
+
}
|
|
358
|
+
serviceRef.current?.cleanup();
|
|
359
|
+
InCallManager.stop();
|
|
360
|
+
};
|
|
361
|
+
}, [baseUrl, identificationInfo.identificationId, identificationInfo.sessionId, identificationInfo.videoSessionId, hasGuideShown, appContext.currentWorkflowStep?.required, t, navigation, identificationInfo]);
|
|
362
|
+
const handleCloseSession = () => {
|
|
363
|
+
serviceRef.current?.cleanup();
|
|
364
|
+
// Call onError to notify parent and reset navigation to start over
|
|
365
|
+
onError?.('Video call session closed by user');
|
|
366
|
+
navigationManagerRef.current?.reset();
|
|
367
|
+
};
|
|
368
|
+
if (!identificationInfo || !identificationInfo.identificationId) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Show guide screen first
|
|
373
|
+
if (!hasGuideShown) {
|
|
374
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
375
|
+
style: styles.guide,
|
|
376
|
+
children: [/*#__PURE__*/_jsx(LottieView, {
|
|
377
|
+
source: require('../../Shared/Animations/video-call.json'),
|
|
378
|
+
style: styles.guideAnimation,
|
|
379
|
+
loop: true,
|
|
380
|
+
autoPlay: true
|
|
381
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
382
|
+
style: styles.guideHeader,
|
|
383
|
+
children: t('videoCallScreen.guideHeader')
|
|
384
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
385
|
+
style: styles.guidePoints,
|
|
386
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
387
|
+
style: styles.guideText,
|
|
388
|
+
children: t('videoCallScreen.guideText')
|
|
389
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
390
|
+
style: styles.guideText,
|
|
391
|
+
children: ["\u2022 ", t('videoCallScreen.guidePoint1')]
|
|
392
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
393
|
+
style: styles.guideText,
|
|
394
|
+
children: ["\u2022 ", t('videoCallScreen.guidePoint2')]
|
|
395
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
396
|
+
style: styles.guideText,
|
|
397
|
+
children: ["\u2022 ", t('videoCallScreen.guidePoint3')]
|
|
398
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
399
|
+
style: styles.guideText,
|
|
400
|
+
children: ["\u2022 ", t('videoCallScreen.guidePoint4')]
|
|
401
|
+
})]
|
|
402
|
+
}), /*#__PURE__*/_jsx(StyledButton, {
|
|
403
|
+
mode: "contained",
|
|
404
|
+
onPress: () => {
|
|
405
|
+
setHasGuideShown(true);
|
|
406
|
+
},
|
|
407
|
+
children: t('general.letsGo')
|
|
408
|
+
})]
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
412
|
+
style: styles.container,
|
|
413
|
+
children: [errorMessage ? /*#__PURE__*/_jsxs(View, {
|
|
414
|
+
style: styles.errorContainer,
|
|
415
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
416
|
+
style: styles.errorText,
|
|
417
|
+
children: errorMessage
|
|
418
|
+
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
419
|
+
style: styles.closeSessionButton,
|
|
420
|
+
onPress: handleCloseSession,
|
|
421
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
422
|
+
style: styles.buttonText,
|
|
423
|
+
children: t('videoCallScreen.closeSession')
|
|
424
|
+
})
|
|
425
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
426
|
+
style: styles.closeSessionHint,
|
|
427
|
+
children: t('videoCallScreen.closeSessionHint')
|
|
428
|
+
})]
|
|
429
|
+
}) : remoteStream ? /*#__PURE__*/_jsx(RTCView, {
|
|
430
|
+
streamURL: remoteStream.toURL(),
|
|
431
|
+
style: styles.remoteVideo,
|
|
432
|
+
objectFit: "contain",
|
|
433
|
+
mirror: false
|
|
434
|
+
}) : connectionState === 'connected' ?
|
|
435
|
+
/*#__PURE__*/
|
|
436
|
+
// WebRTC connected but remote stream not yet received — show black background
|
|
437
|
+
// so the PIP local video and controls are visible without "waiting" overlay
|
|
438
|
+
_jsx(View, {
|
|
439
|
+
style: styles.remoteVideo
|
|
440
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
441
|
+
style: styles.waitingContainer,
|
|
442
|
+
children: [/*#__PURE__*/_jsx(ActivityIndicator, {
|
|
443
|
+
size: "large",
|
|
444
|
+
color: "#fff"
|
|
445
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
446
|
+
style: styles.waitingText,
|
|
447
|
+
children: t('videoCallScreen.waitingForAgent')
|
|
448
|
+
}), queuePosition !== null && /*#__PURE__*/_jsx(Text, {
|
|
449
|
+
style: styles.queueText,
|
|
450
|
+
children: t('videoCallScreen.queuePosition', {
|
|
451
|
+
position: queuePosition
|
|
452
|
+
})
|
|
453
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
454
|
+
style: styles.statusText,
|
|
455
|
+
children: t(`videoCallScreen.${connectionState}`)
|
|
456
|
+
}), showLeaveButton && /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
457
|
+
style: styles.leaveQueueButton,
|
|
458
|
+
onPress: handleCloseSession,
|
|
459
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
460
|
+
style: styles.leaveQueueButtonText,
|
|
461
|
+
children: t('videoCallScreen.leaveQueue')
|
|
462
|
+
})
|
|
463
|
+
})]
|
|
464
|
+
}), localStream && /*#__PURE__*/_jsx(View, {
|
|
465
|
+
style: styles.localVideoContainer,
|
|
466
|
+
children: /*#__PURE__*/_jsx(RTCView, {
|
|
467
|
+
streamURL: localStream.toURL(),
|
|
468
|
+
style: styles.localVideo,
|
|
469
|
+
objectFit: "cover",
|
|
470
|
+
mirror: true,
|
|
471
|
+
zOrder: 1
|
|
472
|
+
}, localStreamKey)
|
|
473
|
+
}), agentInstructions.length > 0 && /*#__PURE__*/_jsxs(View, {
|
|
474
|
+
style: styles.instructionsContainer,
|
|
475
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
476
|
+
style: styles.instructionsHeader,
|
|
477
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
478
|
+
style: styles.instructionsTitle,
|
|
479
|
+
children: t('videoCallScreen.agentInstructions')
|
|
480
|
+
})
|
|
481
|
+
}), agentInstructions.map(instruction => /*#__PURE__*/_jsxs(View, {
|
|
482
|
+
style: styles.instructionItem,
|
|
483
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
484
|
+
style: styles.instructionIcon,
|
|
485
|
+
children: "\uD83D\uDCCB"
|
|
486
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
487
|
+
style: styles.instructionText,
|
|
488
|
+
children: instruction.text
|
|
489
|
+
})]
|
|
490
|
+
}, instruction.id))]
|
|
491
|
+
}), /*#__PURE__*/_jsx(NavigationManager, {
|
|
492
|
+
ref: navigationManagerRef
|
|
493
|
+
})]
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
const styles = StyleSheet.create({
|
|
497
|
+
container: {
|
|
498
|
+
flex: 1,
|
|
499
|
+
backgroundColor: '#000'
|
|
500
|
+
},
|
|
501
|
+
remoteVideo: {
|
|
502
|
+
width: width,
|
|
503
|
+
height: height,
|
|
504
|
+
backgroundColor: '#000'
|
|
505
|
+
},
|
|
506
|
+
errorContainer: {
|
|
507
|
+
flex: 1,
|
|
508
|
+
justifyContent: 'center',
|
|
509
|
+
alignItems: 'center',
|
|
510
|
+
padding: 20
|
|
511
|
+
},
|
|
512
|
+
errorText: {
|
|
513
|
+
color: '#fff',
|
|
514
|
+
fontSize: 18,
|
|
515
|
+
textAlign: 'center',
|
|
516
|
+
marginBottom: 30
|
|
517
|
+
},
|
|
518
|
+
retryButton: {
|
|
519
|
+
backgroundColor: '#d32f2f',
|
|
520
|
+
padding: 15,
|
|
521
|
+
borderRadius: 8,
|
|
522
|
+
minWidth: 120,
|
|
523
|
+
alignItems: 'center'
|
|
524
|
+
},
|
|
525
|
+
closeSessionButton: {
|
|
526
|
+
backgroundColor: '#d32f2f',
|
|
527
|
+
paddingVertical: 16,
|
|
528
|
+
paddingHorizontal: 32,
|
|
529
|
+
borderRadius: 8,
|
|
530
|
+
minWidth: 200,
|
|
531
|
+
alignItems: 'center'
|
|
532
|
+
},
|
|
533
|
+
closeSessionHint: {
|
|
534
|
+
color: '#aaa',
|
|
535
|
+
fontSize: 14,
|
|
536
|
+
textAlign: 'center',
|
|
537
|
+
marginTop: 16,
|
|
538
|
+
paddingHorizontal: 40
|
|
539
|
+
},
|
|
540
|
+
waitingContainer: {
|
|
541
|
+
flex: 1,
|
|
542
|
+
justifyContent: 'center',
|
|
543
|
+
alignItems: 'center'
|
|
544
|
+
},
|
|
545
|
+
waitingText: {
|
|
546
|
+
color: '#fff',
|
|
547
|
+
marginTop: 20,
|
|
548
|
+
fontSize: 18
|
|
549
|
+
},
|
|
550
|
+
queueText: {
|
|
551
|
+
color: '#fff',
|
|
552
|
+
marginTop: 10,
|
|
553
|
+
fontSize: 16,
|
|
554
|
+
fontWeight: 'bold'
|
|
555
|
+
},
|
|
556
|
+
statusText: {
|
|
557
|
+
color: '#aaa',
|
|
558
|
+
marginTop: 10,
|
|
559
|
+
fontSize: 14
|
|
560
|
+
},
|
|
561
|
+
localVideoContainer: {
|
|
562
|
+
position: 'absolute',
|
|
563
|
+
top: 50,
|
|
564
|
+
right: 20,
|
|
565
|
+
width: 100,
|
|
566
|
+
height: 150,
|
|
567
|
+
borderRadius: 10,
|
|
568
|
+
overflow: 'hidden',
|
|
569
|
+
borderWidth: 1,
|
|
570
|
+
borderColor: '#fff',
|
|
571
|
+
backgroundColor: '#333'
|
|
572
|
+
},
|
|
573
|
+
localVideo: {
|
|
574
|
+
flex: 1
|
|
575
|
+
},
|
|
576
|
+
instructionsContainer: {
|
|
577
|
+
position: 'absolute',
|
|
578
|
+
bottom: 40,
|
|
579
|
+
left: 20,
|
|
580
|
+
right: 20,
|
|
581
|
+
backgroundColor: 'rgba(59, 130, 246, 0.95)',
|
|
582
|
+
borderRadius: 12,
|
|
583
|
+
padding: 16,
|
|
584
|
+
maxHeight: 200
|
|
585
|
+
},
|
|
586
|
+
instructionsHeader: {
|
|
587
|
+
marginBottom: 12,
|
|
588
|
+
paddingBottom: 8,
|
|
589
|
+
borderBottomWidth: 1,
|
|
590
|
+
borderBottomColor: 'rgba(255, 255, 255, 0.3)'
|
|
591
|
+
},
|
|
592
|
+
instructionsTitle: {
|
|
593
|
+
color: '#fff',
|
|
594
|
+
fontSize: 16,
|
|
595
|
+
fontWeight: 'bold'
|
|
596
|
+
},
|
|
597
|
+
instructionItem: {
|
|
598
|
+
flexDirection: 'row',
|
|
599
|
+
alignItems: 'flex-start',
|
|
600
|
+
backgroundColor: 'rgba(255, 255, 255, 0.15)',
|
|
601
|
+
borderRadius: 8,
|
|
602
|
+
padding: 12,
|
|
603
|
+
marginBottom: 8
|
|
604
|
+
},
|
|
605
|
+
instructionIcon: {
|
|
606
|
+
fontSize: 18,
|
|
607
|
+
marginRight: 10
|
|
608
|
+
},
|
|
609
|
+
instructionText: {
|
|
610
|
+
flex: 1,
|
|
611
|
+
color: '#fff',
|
|
612
|
+
fontSize: 14,
|
|
613
|
+
lineHeight: 20
|
|
614
|
+
},
|
|
615
|
+
controlsContainer: {
|
|
616
|
+
position: 'absolute',
|
|
617
|
+
bottom: 40,
|
|
618
|
+
left: 0,
|
|
619
|
+
right: 0,
|
|
620
|
+
flexDirection: 'row',
|
|
621
|
+
justifyContent: 'space-evenly',
|
|
622
|
+
alignItems: 'center'
|
|
623
|
+
},
|
|
624
|
+
controlButton: {
|
|
625
|
+
width: 60,
|
|
626
|
+
height: 60,
|
|
627
|
+
borderRadius: 30,
|
|
628
|
+
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
629
|
+
justifyContent: 'center',
|
|
630
|
+
alignItems: 'center'
|
|
631
|
+
},
|
|
632
|
+
endCallButton: {
|
|
633
|
+
backgroundColor: '#ff4444'
|
|
634
|
+
},
|
|
635
|
+
buttonText: {
|
|
636
|
+
color: '#fff',
|
|
637
|
+
fontSize: 12
|
|
638
|
+
},
|
|
639
|
+
leaveQueueButton: {
|
|
640
|
+
marginTop: 24,
|
|
641
|
+
paddingVertical: 12,
|
|
642
|
+
paddingHorizontal: 32,
|
|
643
|
+
borderRadius: 8,
|
|
644
|
+
borderWidth: 1,
|
|
645
|
+
borderColor: '#fff'
|
|
646
|
+
},
|
|
647
|
+
leaveQueueButtonText: {
|
|
648
|
+
color: '#fff',
|
|
649
|
+
fontSize: 15
|
|
650
|
+
},
|
|
651
|
+
guide: {
|
|
652
|
+
flex: 1,
|
|
653
|
+
justifyContent: 'center',
|
|
654
|
+
paddingHorizontal: 20,
|
|
655
|
+
gap: 10,
|
|
656
|
+
backgroundColor: 'white'
|
|
657
|
+
},
|
|
658
|
+
guideAnimation: {
|
|
659
|
+
width: 250,
|
|
660
|
+
height: 250,
|
|
661
|
+
alignSelf: 'center'
|
|
662
|
+
},
|
|
663
|
+
guideHeader: {
|
|
664
|
+
color: 'black',
|
|
665
|
+
fontSize: 18,
|
|
666
|
+
textAlign: 'center',
|
|
667
|
+
fontWeight: 'bold'
|
|
668
|
+
},
|
|
669
|
+
guidePoints: {
|
|
670
|
+
gap: 10,
|
|
671
|
+
padding: 10
|
|
672
|
+
},
|
|
673
|
+
guideText: {
|
|
674
|
+
color: 'black',
|
|
675
|
+
fontSize: 14
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
export default VideoCallScreen;
|
|
@@ -15,8 +15,11 @@ import { useTheme } from "../../Shared/Contexts/ThemeContext.js";
|
|
|
15
15
|
import LottieView from 'lottie-react-native';
|
|
16
16
|
import { getSimulatedDemoData } from "../../Shared/Libs/demo.utils.js";
|
|
17
17
|
import { trackError, useScreenTracking } from "../../Shared/Libs/analytics.utils.js";
|
|
18
|
+
import { useKeepAwake } from "../../Shared/Libs/native-keep-awake.utils.js";
|
|
19
|
+
import { useStatusBarWhiteBackground } from "../../Shared/Libs/status-bar.utils.js";
|
|
18
20
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
21
|
const OTPVerificationScreen = () => {
|
|
22
|
+
useKeepAwake();
|
|
20
23
|
const route = useRoute();
|
|
21
24
|
const sessionId = route.params?.sessionId;
|
|
22
25
|
const [code, setCode] = useState('');
|
|
@@ -33,6 +36,9 @@ const OTPVerificationScreen = () => {
|
|
|
33
36
|
const primaryColor = theme.colors.primary;
|
|
34
37
|
useScreenTracking('otp_verification');
|
|
35
38
|
|
|
39
|
+
// Configure status bar for white background
|
|
40
|
+
useStatusBarWhiteBackground();
|
|
41
|
+
|
|
36
42
|
// Guard: If sessionId is not provided, show error
|
|
37
43
|
if (!sessionId) {
|
|
38
44
|
return /*#__PURE__*/_jsx(SafeAreaView, {
|