chore: Remove unused Jitsi deep link (#5361)

This commit is contained in:
Diego Mello 2023-11-23 10:11:11 -03:00 committed by GitHub
parent 698973fbe2
commit 911957ba66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 45 deletions

View File

@ -7,7 +7,6 @@ interface IParams {
rid: string; rid: string;
messageId: string; messageId: string;
host: string; host: string;
isCall: boolean;
fullURL: string; fullURL: string;
type: string; type: string;
token: string; token: string;

View File

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

View File

@ -1,5 +1,4 @@
import { ERoomTypes } from '../../definitions'; import { ERoomTypes } from '../../definitions';
import { store } from '../store/auxStore';
import database from '../database'; import database from '../database';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import { Services } from '../services'; import { Services } from '../services';
@ -63,18 +62,11 @@ async function open({ type, rid, name }: { type: ERoomTypes; rid: string; name:
} }
} }
export async function canOpenRoom({ rid, path, isCall }: { rid: string; isCall: boolean; path: string }): Promise<any> { export async function canOpenRoom({ rid, path }: { rid: string; path: string }): Promise<any> {
try { try {
const db = database.active; const db = database.active;
const subsCollection = db.get('subscriptions'); const subsCollection = db.get('subscriptions');
if (isCall && !rid) {
// Extract rid from a Jitsi URL
// Eg.: [Jitsi_URL_Room_Prefix][uniqueID][rid][?jwt]
const { Jitsi_URL_Room_Prefix, uniqueID } = store.getState().settings;
rid = path.replace(`${Jitsi_URL_Room_Prefix}${uniqueID}`, '').replace(/\?(.*)/g, '');
}
if (rid) { if (rid) {
try { try {
const room = await subsCollection.find(rid); const room = await subsCollection.find(rid);

View File

@ -160,7 +160,8 @@ export async function getSettings(): Promise<void> {
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
const response = await fetch( const response = await fetch(
`${sdk.current.client.host}/api/v1/settings.public?query={"_id":{"$in":${JSON.stringify(settingsParams)}}} `${sdk.current.client.host}/api/v1/settings.public?query={"_id":{"$in":${JSON.stringify(settingsParams)}}}
&offset=${offset}`); &offset=${offset}`
);
const result = await response.json(); const result = await response.json();
@ -172,7 +173,7 @@ export async function getSettings(): Promise<void> {
settings = [...settings, ...result.settings]; settings = [...settings, ...result.settings];
remaining = result.total - settings.length; remaining = result.total - settings.length;
/* eslint-enable no-await-in-loop */ /* eslint-enable no-await-in-loop */
} while(remaining > 0); } while (remaining > 0);
const data: IData[] = settings; const data: IData[] = settings;
const filteredSettings: IPreparedSettings[] = _prepareSettings(data); const filteredSettings: IPreparedSettings[] = _prepareSettings(data);

View File

@ -12,7 +12,6 @@ interface IEjson {
sender: { username: string; name: string }; sender: { username: string; name: string };
type: string; type: string;
host: string; host: string;
messageType: string;
messageId: string; messageId: string;
} }
@ -20,7 +19,7 @@ export const onNotification = (push: INotification): void => {
if (push.payload) { if (push.payload) {
try { try {
const notification = push.payload; const notification = push.payload;
const { rid, name, sender, type, host, messageType, messageId }: IEjson = EJSON.parse(notification.ejson); const { rid, name, sender, type, host, messageId }: IEjson = EJSON.parse(notification.ejson);
const types: Record<string, string> = { const types: Record<string, string> = {
c: 'channel', c: 'channel',
@ -37,8 +36,7 @@ export const onNotification = (push: INotification): void => {
host, host,
rid, rid,
messageId, messageId,
path: `${types[type]}/${roomName}`, path: `${types[type]}/${roomName}`
isCall: messageType === 'jitsi_call_started'
}; };
store.dispatch(deepLinkingOpen(params)); store.dispatch(deepLinkingOpen(params));
} catch (e) { } catch (e) {

View File

@ -14,7 +14,7 @@ import { loginRequest } from '../actions/login';
import log from '../lib/methods/helpers/log'; import log from '../lib/methods/helpers/log';
import { RootEnum } from '../definitions'; import { RootEnum } from '../definitions';
import { CURRENT_SERVER, TOKEN_KEY } from '../lib/constants'; import { CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
import { callJitsi, callJitsiWithoutServer, canOpenRoom, getServerInfo } from '../lib/methods'; import { canOpenRoom, getServerInfo } from '../lib/methods';
import { Services } from '../lib/services'; import { Services } from '../lib/services';
const roomTypes = { const roomTypes = {
@ -59,9 +59,6 @@ const navigate = function* navigate({ params }) {
const jumpToMessageId = params.messageId; const jumpToMessageId = params.messageId;
yield goRoom({ item, isMasterDetail, jumpToMessageId, jumpToThreadId, popToRoot: true }); yield goRoom({ item, isMasterDetail, jumpToMessageId, jumpToThreadId, popToRoot: true });
if (params.isCall) {
callJitsi(item);
}
} }
} else { } else {
yield handleInviteLink({ params }); yield handleInviteLink({ params });
@ -91,20 +88,6 @@ const handleOpen = function* handleOpen({ params }) {
const serversCollection = serversDB.get('servers'); const serversCollection = serversDB.get('servers');
let { host } = params; let { host } = params;
if (params.isCall && !host) {
const servers = yield serversCollection.query().fetch();
// search from which server is that call
servers.forEach(({ uniqueID, id }) => {
if (params.path.includes(uniqueID)) {
host = id;
}
});
if (!host && params.fullURL) {
callJitsiWithoutServer(params.fullURL);
return;
}
}
if (params.type === 'oauth') { if (params.type === 'oauth') {
yield handleOAuth({ params }); yield handleOAuth({ params });

View File

@ -436,7 +436,9 @@ class ShareListView extends React.Component<IShareListViewProps, IState> {
contentContainerStyle={[styles.container, styles.centered, { backgroundColor: themes[theme].backgroundColor }]} contentContainerStyle={[styles.container, styles.centered, { backgroundColor: themes[theme].backgroundColor }]}
> >
<Text style={[styles.permissionTitle, { color: themes[theme].titleText }]}>{I18n.t('Read_External_Permission')}</Text> <Text style={[styles.permissionTitle, { color: themes[theme].titleText }]}>{I18n.t('Read_External_Permission')}</Text>
<Text style={[styles.permissionMessage, { color: themes[theme].bodyText }]}>{I18n.t('Read_External_Permission_Message')}</Text> <Text style={[styles.permissionMessage, { color: themes[theme].bodyText }]}>
{I18n.t('Read_External_Permission_Message')}
</Text>
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );

View File

@ -11,7 +11,6 @@
<key>com.apple.developer.associated-domains</key> <key>com.apple.developer.associated-domains</key>
<array> <array>
<string>applinks:go.rocket.chat</string> <string>applinks:go.rocket.chat</string>
<string>applinks:jitsi.rocket.chat</string>
</array> </array>
<key>com.apple.security.application-groups</key> <key>com.apple.security.application-groups</key>
<array> <array>