[IMPROVE] Open Jitsi call even if server isn't found (#3442)

This commit is contained in:
Alex Junior 2021-11-16 13:04:33 -03:00 committed by GitHub
parent c216544cc4
commit 251b42ca54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 10 deletions

View File

@ -63,10 +63,12 @@ const parseDeepLinking = (url: string) => {
} }
} }
const call = /^(https:\/\/)?jitsi.rocket.chat\//; const call = /^(https:\/\/)?jitsi.rocket.chat\//;
const fullURL = url;
if (url.match(call)) { if (url.match(call)) {
url = url.replace(call, '').trim(); url = url.replace(call, '').trim();
if (url) { if (url) {
return { path: url, isCall: true }; return { path: url, isCall: true, fullURL };
} }
} }
} }

View File

@ -36,6 +36,14 @@ async function jitsiURL({ room }) {
return `${protocol}${domain}${prefix}${rname}${queryString}`; return `${protocol}${domain}${prefix}${rname}${queryString}`;
} }
export function callJitsiWithoutServer(path) {
logEvent(events.RA_JITSI_VIDEO);
const { Jitsi_SSL } = reduxStore.getState().settings;
const protocol = Jitsi_SSL ? 'https://' : 'http://';
const url = `${protocol}${path}`;
Navigation.navigate('JitsiMeetView', { url, onlyAudio: false });
}
async function callJitsi(room, onlyAudio = false) { async function callJitsi(room, onlyAudio = false) {
logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO); logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO);
const url = await jitsiURL.call(this, { room }); const url = await jitsiURL.call(this, { room });

View File

@ -54,7 +54,7 @@ import loadMissedMessages from './methods/loadMissedMessages';
import loadThreadMessages from './methods/loadThreadMessages'; import loadThreadMessages from './methods/loadThreadMessages';
import sendMessage, { resendMessage } from './methods/sendMessage'; import sendMessage, { resendMessage } from './methods/sendMessage';
import { cancelUpload, isUploadActive, sendFileMessage } from './methods/sendFileMessage'; 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 logout, { removeServer } from './methods/logout';
import UserPreferences from './userPreferences'; import UserPreferences from './userPreferences';
import { Encryption } from './encryption'; import { Encryption } from './encryption';
@ -76,6 +76,7 @@ const RocketChat = {
CURRENT_SERVER, CURRENT_SERVER,
CERTIFICATE_KEY, CERTIFICATE_KEY,
callJitsi, callJitsi,
callJitsiWithoutServer,
async subscribeRooms() { async subscribeRooms() {
if (!this.roomsSub) { if (!this.roomsSub) {
try { try {

View File

@ -122,6 +122,11 @@ const handleOpen = function* handleOpen({ params }) {
host = id; host = id;
} }
}); });
if (!host && params.fullURL) {
RocketChat.callJitsiWithoutServer(params.fullURL);
return;
}
} }
if (params.type === 'oauth') { if (params.type === 'oauth') {

View File

@ -81,6 +81,7 @@ class JitsiMeetView extends React.Component {
// call is not ended and is available to web users. // call is not ended and is available to web users.
onConferenceJoined = () => { onConferenceJoined = () => {
logEvent(events.JM_CONFERENCE_JOIN); logEvent(events.JM_CONFERENCE_JOIN);
if (this.rid) {
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e)); RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
if (this.jitsiTimeout) { if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout); BackgroundTimer.clearInterval(this.jitsiTimeout);
@ -90,6 +91,7 @@ class JitsiMeetView extends React.Component {
this.jitsiTimeout = BackgroundTimer.setInterval(() => { this.jitsiTimeout = BackgroundTimer.setInterval(() => {
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e)); RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
}, 10000); }, 10000);
}
}; };
onConferenceTerminated = () => { onConferenceTerminated = () => {