Skip to content

Commit

Permalink
open channel call in integrated window without ringning
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyril Gromoff committed Aug 15, 2024
1 parent 4df441d commit f1706fc
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions webapp/channels/src/actions/calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);

Expand Down

0 comments on commit f1706fc

Please sign in to comment.