migrate @socialcode-rob1/react-native-jitsimeet-custom from to react-native-jitsi

This commit is contained in:
GleidsonDaniel 2023-03-14 17:33:44 -03:00
parent 4dfc9c70f3
commit d8435c5bb2
6 changed files with 20 additions and 55 deletions

View File

@ -1,8 +1,6 @@
// @ts-ignore
// eslint-disable-next-line import/no-unresolved
import JitsiMeet from '@socialcode-rob1/react-native-jitsimeet-custom';
import React, { useEffect } from 'react';
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
import JitsiMeet from 'react-native-jitsi';
import RCActivityIndicator from '../containers/ActivityIndicator';
import { useAppSelector } from '../lib/hooks';
@ -17,7 +15,7 @@ const formatUrl = (url: string, baseUrl: string, uriSize: number, avatarAuthURLF
const JitsiMeetView = (): React.ReactElement => {
const { goBack } = useNavigation();
const {
params: { url, onlyAudio, videoConf, rid }
params: { url, videoConf, rid }
} = useRoute<RouteProp<ChatsStackParamList, 'JitsiMeetView'>>();
const user = useAppSelector(state => getUserSelector(state));
const baseUrl = useAppSelector(state => state.server.server);
@ -27,44 +25,21 @@ const JitsiMeetView = (): React.ReactElement => {
}, []);
const initJitsi = async () => {
const audioOnly = onlyAudio ?? false;
const { name, id: userId, token, username } = user;
const avatarAuthURLFragment = `&rc_token=${token}&rc_uid=${userId}`;
const avatar = formatUrl(username, baseUrl, 100, avatarAuthURLFragment);
const userInfo = {
displayName: name as string,
avatar
};
const regex = /(?:\/.*\/)(.*)/;
const urlWithoutServer = regex.exec(url)![1];
const serverUrl = url.replace(`/${urlWithoutServer}`, '');
const room = (url.includes('jwt=') ? urlWithoutServer.split('jwt=')[0] : urlWithoutServer.split('#')[0]).replace('?', '');
const jwtToken = url.includes('jwt=') ? url.substring(url.indexOf('jwt=') + 4, url.lastIndexOf('#config')) : undefined;
const conferenceOptions = {
room,
serverUrl,
url: `${url}`,
userInfo: {
displayName: userInfo.displayName,
avatar: userInfo.avatar
},
subject: room,
audioOnly,
audioMuted: false,
videoMuted: audioOnly,
token: jwtToken,
featureFlags: {
'calendar.enabled': false
},
configOverrides: {
'breakoutRooms.hideAddRoomButton': false
displayName: name as string,
avatar
}
};
logEvent(videoConf ? events.LIVECHAT_VIDEOCONF_JOIN : events.JM_CONFERENCE_JOIN);
if (!videoConf) initVideoConfTimer(rid);
await JitsiMeet.launchJitsiMeetView(conferenceOptions);
logEvent(videoConf ? events.LIVECHAT_VIDEOCONF_TERMINATE : events.JM_CONFERENCE_TERMINATE);
logEvent(videoConf ? events.LIVECHAT_VIDEOCONF_JOIN : events.JM_CONFERENCE_JOIN);
await JitsiMeet.launch(conferenceOptions);
if (!videoConf) endVideoConfTimer();
logEvent(videoConf ? events.LIVECHAT_VIDEOCONF_TERMINATE : events.JM_CONFERENCE_TERMINATE);
goBack();
};

View File

@ -366,7 +366,7 @@ PODS:
- React-Core
- react-native-document-picker (8.1.2):
- React-Core
- react-native-jitsimeet-custom (2.5.0):
- react-native-jitsi (0.2.0):
- JitsiMeetSDKLite (= 7.0.1-lite)
- React-Core
- react-native-mmkv-storage (0.8.0):
@ -630,7 +630,7 @@ DEPENDENCIES:
- "react-native-cameraroll (from `../node_modules/@react-native-community/cameraroll`)"
- "react-native-cookies (from `../node_modules/@react-native-cookies/cookies`)"
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
- "react-native-jitsimeet-custom (from `../node_modules/@socialcode-rob1/react-native-jitsimeet-custom`)"
- react-native-jitsi (from `../node_modules/react-native-jitsi`)
- react-native-mmkv-storage (from `../node_modules/react-native-mmkv-storage`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-notifications (from `../node_modules/react-native-notifications`)
@ -784,8 +784,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-cookies/cookies"
react-native-document-picker:
:path: "../node_modules/react-native-document-picker"
react-native-jitsimeet-custom:
:path: "../node_modules/@socialcode-rob1/react-native-jitsimeet-custom"
react-native-jitsi:
:path: "../node_modules/react-native-jitsi"
react-native-mmkv-storage:
:path: "../node_modules/react-native-mmkv-storage"
react-native-netinfo:
@ -946,7 +946,7 @@ SPEC CHECKSUMS:
react-native-cameraroll: 2957f2bce63ae896a848fbe0d5352c1bd4d20866
react-native-cookies: f54fcded06bb0cda05c11d86788020b43528a26c
react-native-document-picker: f5ec1a712ca2a975c233117f044817bb8393cad4
react-native-jitsimeet-custom: a57ca376bfc1c69f639b138f2de2a10e0ed42c04
react-native-jitsi: 1206782a7b4d48db0638fbacc777914a9c654a28
react-native-mmkv-storage: 8ba3c0216a6df283ece11205b442a3e435aec4e5
react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d
react-native-notifications: 83b4fd4a127a6c918fc846cae90da60f84819e44

View File

@ -63,7 +63,6 @@
"@rocket.chat/message-parser": "^0.31.14",
"@rocket.chat/sdk": "RocketChat/Rocket.Chat.js.SDK#mobile",
"@rocket.chat/ui-kit": "^0.31.19",
"@socialcode-rob1/react-native-jitsimeet-custom": "socialcode-rob1/react-native-jitsimeet-custom.git",
"bytebuffer": "^5.0.1",
"color2k": "1.2.4",
"commonmark": "git+https://github.com/RocketChat/commonmark.js.git",
@ -105,6 +104,7 @@
"react-native-gesture-handler": "2.4.2",
"react-native-image-crop-picker": "RocketChat/react-native-image-crop-picker",
"react-native-image-progress": "^1.1.1",
"react-native-jitsi": "^0.2.0",
"react-native-keycommands": "2.0.3",
"react-native-linear-gradient": "^2.6.2",
"react-native-localize": "2.1.1",

View File

@ -1,11 +0,0 @@
diff --git a/node_modules/@socialcode-rob1/react-native-jitsimeet-custom/react-native-jitsimeet-custom.podspec b/node_modules/@socialcode-rob1/react-native-jitsimeet-custom/react-native-jitsimeet-custom.podspec
index 80a584b..5b2f71c 100644
--- a/node_modules/@socialcode-rob1/react-native-jitsimeet-custom/react-native-jitsimeet-custom.podspec
+++ b/node_modules/@socialcode-rob1/react-native-jitsimeet-custom/react-native-jitsimeet-custom.podspec
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"
s.dependency "React-Core"
- s.dependency 'JitsiMeetSDK', '6.2.2'
+ s.dependency 'JitsiMeetSDKLite', '7.0.1-lite'
end

View File

@ -15,7 +15,7 @@ module.exports = {
android: null
}
},
'@socialcode-rob1/react-native-jitsimeet-custom': {
'react-native-jitsi': {
platforms: {
android: null
}

View File

@ -5431,10 +5431,6 @@
dependencies:
"@sinonjs/commons" "^1.7.0"
"@socialcode-rob1/react-native-jitsimeet-custom@socialcode-rob1/react-native-jitsimeet-custom.git":
version "2.5.0"
resolved "https://codeload.github.com/socialcode-rob1/react-native-jitsimeet-custom/tar.gz/b1f57cd065028fef2e806824e176d2b54e12cfaf"
"@storybook/addon-storyshots@6.3":
version "6.3.13"
resolved "https://registry.yarnpkg.com/@storybook/addon-storyshots/-/addon-storyshots-6.3.13.tgz#282a48880e5074baea7b84f5b091591eb21a9485"
@ -17420,6 +17416,11 @@ react-native-iphone-x-helper@^1.0.3:
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.2.1.tgz#645e2ffbbb49e80844bb4cbbe34a126fda1e6772"
integrity sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ==
react-native-jitsi@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/react-native-jitsi/-/react-native-jitsi-0.2.0.tgz#a47a5e687621461c74266beb8f534b16ea376a33"
integrity sha512-ueodexdSlHRsKWZmd23UIoCHIwxMwfcYcgRRXW+XAaMxyyqJKnMBQtfzGNH4ffh4qq9Skb/EkG38+721SGkZzQ==
react-native-keycommands@2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/react-native-keycommands/-/react-native-keycommands-2.0.3.tgz#09b799c1f70832e5cd9fbdb712ddaa3ee683f70e"