Skip to content

Commit

Permalink
Merge branch 'add-calls-in-channel' into 'master'
Browse files Browse the repository at this point in the history
add calls in channel without ringing

See merge request kchat/webapp!870
  • Loading branch information
antonbuks committed Aug 15, 2024
2 parents fcc7a44 + f1706fc commit ca4a837
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 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
7 changes: 1 addition & 6 deletions webapp/channels/src/actions/kmeet_calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit ca4a837

Please sign in to comment.