diff --git a/webapp/channels/src/actions/calls.ts b/webapp/channels/src/actions/calls.ts index b673b0ac77..a569a8af99 100644 --- a/webapp/channels/src/actions/calls.ts +++ b/webapp/channels/src/actions/calls.ts @@ -180,18 +180,24 @@ export function startOrJoinCallInChannelV2(channelID: string) { }, }); - if (channel.type === 'O' || channel.type === 'P') { - openWebCallInNewTab(data.url, data.jwt, data.name); - return; - } - if (data && data.url) { - if (isDesktopApp() && !isDesktopExtendedCallSupported()) { + const isOpenOrPrivateChannel = (channel.type === 'O' || channel.type === 'P'); + + // prevent Autojoin when we are in DM or GM and launch directly KmeetWindow for Open and Private message + if (isOpenOrPrivateChannel) { + if (isDesktopApp() && isDesktopExtendedCallSupported()) { + dispatch(startKmeetWindow(data.id, channel.id)); + return; + } + + // keep opening meeting in new tab for the webapp openWebCallInNewTab(data.url, data.jwt, data.name); return; } + // keep ringing behaviour for DM and GM dispatch(openCallDialingModal(channelID)); + return; } } catch (error) { console.error('call could not be started', error); @@ -280,9 +286,11 @@ export function callNoLongerExist(endMsg: any) { export function joinCall(conferenceId: string, meetingUrl: string) { return async (dispatch: DispatchFunc) => { Client4.acceptIncomingMeetCall(conferenceId); + const channelID = getCurrentChannelId(state); if (isDesktopApp()) { - dispatch(startKmeetWindow(conferenceId)); + // si desktop app on rejoins bien sur la fenetre integrée. + dispatch(startKmeetWindow(conferenceId, channelID)); return; } @@ -302,11 +310,10 @@ export function hangUpCall() { }; } -export function startKmeetWindow(conferenceId?: string) { +export function startKmeetWindow(conferenceId: string, channelID: string) { return async (_: DispatchFunc, getState: () => GlobalState) => { const state = getState(); const user = getCurrentUser(state); - const channelID = getCurrentChannelId(state); const avatar = Client4.getProfilePictureUrl(user.id, user.last_picture_update); const locale = getCurrentLocale(state); diff --git a/webapp/channels/src/actions/kmeet_calls.ts b/webapp/channels/src/actions/kmeet_calls.ts index 2cd7e5cb72..fb81ab5cb9 100644 --- a/webapp/channels/src/actions/kmeet_calls.ts +++ b/webapp/channels/src/actions/kmeet_calls.ts @@ -172,16 +172,11 @@ export function cancelCall(channelId: string) { } export function startCall(channelId: string, jwt: string, url: string, subject: string) { - return async (dispatch: DispatchFunc, getState: GetStateFunc) => { + return async (dispatch: DispatchFunc) => { if (isDesktopApp()) { - const channel = getChannel(getState(), channelId); if (!isDesktopExtendedCallSupported()) { - if (channel.type === 'O' || channel.type === 'P') { - openWebCallInNewTab(url, jwt, subject); - } return; } - dispatch(startDesktopCall(channelId, jwt, subject)); } else { dispatch(closeModal(ModalIdentifiers.INCOMING_CALL));