feat(CallScreen): enhance video call functionality and UI updates
- Integrated video call support by adding local and remote video stream handling. - Implemented state management for video track detection in both local and peer streams. - Updated UI to conditionally render video components based on the presence of video tracks. - Added video toggle functionality to enable or disable local video during calls. - Enhanced incoming call modal to display call type (voice or video). - Refactored call store to manage call types and video state more effectively.
This commit is contained in:
@@ -26,7 +26,7 @@ import { messageService } from '../../../../services/messageService';
|
||||
import { uploadService } from '../../../../services/uploadService';
|
||||
import { ApiError } from '../../../../services/api';
|
||||
// 【新架构】使用 MessageManager
|
||||
import { useChat, useGroupTyping, useGroupMuted, messageManager } from '../../../../stores';
|
||||
import { useChat, useGroupTyping, useGroupMuted, messageManager, callStore } from '../../../../stores';
|
||||
import { groupService } from '../../../../services/groupService';
|
||||
import { userManager } from '../../../../stores/userManager';
|
||||
import { groupManager } from '../../../../stores/groupManager';
|
||||
@@ -1060,6 +1060,24 @@ export const useChatScreen = () => {
|
||||
// 处理更多功能
|
||||
const handleMoreAction = useCallback((actionId: string) => {
|
||||
switch (actionId) {
|
||||
case 'voice_call':
|
||||
if (!isGroupChat && otherUser?.id && conversationId) {
|
||||
callStore.getState().startCall(conversationId, otherUser.id, {
|
||||
nickname: otherUser.nickname,
|
||||
avatar: otherUser.avatar,
|
||||
}, 'voice');
|
||||
}
|
||||
setActivePanel('none');
|
||||
break;
|
||||
case 'video_call':
|
||||
if (!isGroupChat && otherUser?.id && conversationId) {
|
||||
callStore.getState().startCall(conversationId, otherUser.id, {
|
||||
nickname: otherUser.nickname,
|
||||
avatar: otherUser.avatar,
|
||||
}, 'video');
|
||||
}
|
||||
setActivePanel('none');
|
||||
break;
|
||||
case 'image':
|
||||
handlePickImage();
|
||||
break;
|
||||
@@ -1077,7 +1095,7 @@ export const useChatScreen = () => {
|
||||
default:
|
||||
setActivePanel('none');
|
||||
}
|
||||
}, [handlePickImage, handleTakePhoto]);
|
||||
}, [handlePickImage, handleTakePhoto, isGroupChat, otherUser, conversationId]);
|
||||
|
||||
// 插入表情
|
||||
const handleInsertEmoji = useCallback((emoji: string) => {
|
||||
|
||||
Reference in New Issue
Block a user