Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/lib/methods/callJitsi.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ async function jitsiURL({ room }) {
return `${protocol}${domain}${prefix}${rname}${queryString}`;
}

export function callJitsiWithoutServer(path) {
logEvent(events.RA_JITSI_VIDEO);
const { Jitsi_Domain, Jitsi_SSL } = reduxStore.getState().settings;
const protocol = Jitsi_SSL ? 'https://' : 'http://';
const url = `${protocol}${Jitsi_Domain}/${path}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk about this one.
The goal of the PR is to do a fallback, but here we're assuming they're on the right server, which might not be the case.

Example:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I didn't know that was possible.
To do that, I needed to pass the full url to the deepLinking function, today we pass just the path.
with the full url, I just call the function to open the meeting.

What do you think about this solution ?

Navigation.navigate('JitsiMeetView', { url, onlyAudio: false });
}

async function callJitsi(room, onlyAudio = false) {
logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO);
const url = await jitsiURL.call(this, { room });
Expand Down
3 changes: 2 additions & 1 deletion app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import loadMissedMessages from './methods/loadMissedMessages';
import loadThreadMessages from './methods/loadThreadMessages';
import sendMessage, { resendMessage } from './methods/sendMessage';
import { cancelUpload, isUploadActive, sendFileMessage } from './methods/sendFileMessage';
import callJitsi from './methods/callJitsi';
import callJitsi, { callJitsiWithoutServer } from './methods/callJitsi';
import logout, { removeServer } from './methods/logout';
import UserPreferences from './userPreferences';
import { Encryption } from './encryption';
Expand All @@ -75,6 +75,7 @@ const RocketChat = {
CURRENT_SERVER,
CERTIFICATE_KEY,
callJitsi,
callJitsiWithoutServer,
async subscribeRooms() {
if (!this.roomsSub) {
try {
Expand Down
5 changes: 5 additions & 0 deletions app/sagas/deepLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ const handleOpen = function* handleOpen({ params }) {
host = id;
}
});

if (!host) {
RocketChat.callJitsiWithoutServer(params.path);
return;
}
}

if (params.type === 'oauth') {
Expand Down
18 changes: 10 additions & 8 deletions app/views/JitsiMeetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ class JitsiMeetView extends React.Component {
// call is not ended and is available to web users.
onConferenceJoined = () => {
logEvent(events.JM_CONFERENCE_JOIN);
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
BackgroundTimer.stopBackgroundTimer();
this.jitsiTimeout = null;
}
this.jitsiTimeout = BackgroundTimer.setInterval(() => {
if (this.rid) {
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
}, 10000);
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
BackgroundTimer.stopBackgroundTimer();
this.jitsiTimeout = null;
}
this.jitsiTimeout = BackgroundTimer.setInterval(() => {
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
}, 10000);
}
};

onConferenceTerminated = () => {
Expand Down