diff --git a/apps/meteor/client/providers/VideoConfProvider.tsx b/apps/meteor/client/providers/VideoConfProvider.tsx index f6de91243f556c43769eea3ae3ac88bb5c0d9505..f29d2651e6b858ed828020008bb956068ccd7f38 100644 --- a/apps/meteor/client/providers/VideoConfProvider.tsx +++ b/apps/meteor/client/providers/VideoConfProvider.tsx @@ -8,6 +8,12 @@ import { VideoConfManager, DirectCallParams, ProviderCapabilities, CallPreferenc import VideoConfBlockModal from '../views/room/contextualBar/VideoConference/VideoConfBlockModal'; import VideoConfPopups from '../views/room/contextualBar/VideoConference/VideoConfPopups'; +type WindowMaybeDesktop = typeof window & { + RocketChatDesktop?: { + openInternalVideoChatWindow?: (url: string, options: undefined) => void; + }; +}; + const VideoConfContextProvider = ({ children }: { children: ReactNode }): ReactElement => { const [outgoing, setOutgoing] = useState<VideoConfPopupPayload | undefined>(); const setModal = useSetModal(); @@ -15,16 +21,21 @@ const VideoConfContextProvider = ({ children }: { children: ReactNode }): ReactE useEffect( () => VideoConfManager.on('call/join', (props) => { - const open = (): void => { - const popup = window.open(props.url); + const windowMaybeDesktop = window as WindowMaybeDesktop; + if (windowMaybeDesktop.RocketChatDesktop?.openInternalVideoChatWindow) { + windowMaybeDesktop.RocketChatDesktop.openInternalVideoChatWindow(props.url, undefined); + } else { + const open = (): void => { + const popup = window.open(props.url); - if (popup !== null) { - return; - } + if (popup !== null) { + return; + } - setModal(<VideoConfBlockModal onClose={(): void => setModal(null)} onConfirm={open} />); - }; - open(); + setModal(<VideoConfBlockModal onClose={(): void => setModal(null)} onConfirm={open} />); + }; + open(); + } }), [setModal], );