feat(CallScreen, FloatingCallWindow, callStore, wsService): enhance call status handling and UI updates
- Updated call status messages to include 'calling', 'reconnecting', and 'failed' states for better user feedback. - Improved video handling logic in CallScreen to use currentCall.isVideoEnabled for local video display. - Enhanced callStore to manage new call statuses and ensure proper timeout handling during 'calling' state. - Added a method in wsService to retrieve the active call state after WebSocket reconnections. - Refactored FloatingCallWindow to reflect updated call status messages for consistency across components.
This commit is contained in:
@@ -59,14 +59,20 @@ const CallScreen: React.FC = () => {
|
||||
if (!currentCall || isMinimized) return null;
|
||||
const getStatusText = (): string => {
|
||||
switch (currentCall.status) {
|
||||
case 'ringing':
|
||||
case 'calling':
|
||||
return '正在等待对方接听...';
|
||||
case 'ringing':
|
||||
return '来电响铃中...';
|
||||
case 'connecting':
|
||||
return '连接中...';
|
||||
case 'connected':
|
||||
return formatDuration(callDuration);
|
||||
case 'ending':
|
||||
case 'reconnecting':
|
||||
return '网络重连中...';
|
||||
case 'ended':
|
||||
return '通话已结束';
|
||||
case 'failed':
|
||||
return '连接失败';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -88,7 +94,10 @@ const CallScreen: React.FC = () => {
|
||||
};
|
||||
// Determine if we should show video UI
|
||||
const showRemoteVideo = hasPeerVideo;
|
||||
const showLocalVideo = hasLocalVideo;
|
||||
// Use currentCall.isVideoEnabled directly for local video
|
||||
// This is more reliable than checking localStream.getVideoTracks()
|
||||
// because the stream object reference may not trigger useEffect properly
|
||||
const showLocalVideo = currentCall?.isVideoEnabled && localStream;
|
||||
const isVideoCallActive = showRemoteVideo || showLocalVideo;
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
||||
@@ -27,14 +27,20 @@ const FloatingCallWindow: React.FC = () => {
|
||||
|
||||
const getStatusText = (): string => {
|
||||
switch (currentCall.status) {
|
||||
case 'ringing':
|
||||
case 'calling':
|
||||
return '等待接听...';
|
||||
case 'ringing':
|
||||
return '来电响铃...';
|
||||
case 'connecting':
|
||||
return '连接中...';
|
||||
case 'connected':
|
||||
return formatDuration(callDuration);
|
||||
case 'ending':
|
||||
case 'reconnecting':
|
||||
return '重连中...';
|
||||
case 'ended':
|
||||
return '已结束';
|
||||
case 'failed':
|
||||
return '连接失败';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user