import React from 'react'; import { GestureResponderEvent } from 'react-native'; import { IContact } from '../../store/contacts/types'; import { callPBX } from '../../store/pbx/pbxSlice'; import { startCall } from '../../store/webrtc/webrtcSlice'; import { CallDialogView } from './CallDialogView'; import { useAppDispatch } from '../../store/hooks'; interface ICallDialogProps { contact: IContact; onPress?: (event: GestureResponderEvent) => void; webRtcActions: IWebRtcCallActionProps[]; showDialog: boolean; openDialog: () => void; pbxEnabled: boolean; webrtcEnabled: boolean; } export interface IWebRtcCallActionProps { iconName: string; actionName: string; callType: 'video' | 'audio'; } export interface IPbxCallActionProps { enablePbxCalls: boolean; } export const CallDialog: React.FunctionComponent = ({ contact, webRtcActions, showDialog, openDialog, webrtcEnabled, pbxEnabled, }) => { const dispatch = useAppDispatch(); const handleCallPBX = (phoneNumber: string) => { dispatch(callPBX(phoneNumber)); }; const handleWebRtcCall = (contactId: string, video: boolean, subject: string) => { dispatch(startCall({contactId,video, subject})); }; return ( ); };