agora-appbuilder-core 2.3.0-beta.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +11 -6
- package/package.json +1 -1
- package/template/Gulpfile.js +121 -83
- package/template/_gitignore +2 -2
- package/template/_package-lock.json +12959 -13248
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +2 -2
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +4 -5
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +3 -1
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +4 -4
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +7 -5
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +1 -1
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +2 -2
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +88 -43
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +13 -4
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +36 -19
- package/template/agora-rn-uikit/src/Utils/permission.ts +17 -6
- package/template/babel.config.js +9 -9
- package/template/bridge/rtc/webNg/RtcEngine.ts +51 -26
- package/template/customization-api/action-library.ts +22 -0
- package/template/{fpe-api/context.ts → customization-api/app-state.ts} +16 -14
- package/template/customization-api/customEvents.ts +9 -0
- package/template/{fpe-api/install.ts → customization-api/customize.ts} +27 -26
- package/template/{fpe-api → customization-api}/index.ts +11 -6
- package/template/{fpe-api/components.ts → customization-api/sub-components.ts} +22 -3
- package/template/{fpe-api → customization-api}/typeDefinition.ts +13 -14
- package/template/customization-api/utils.ts +30 -0
- package/template/{fpe-implementation → customization-implementation}/createHook.ts +0 -0
- package/template/{fpe-implementation/dummyFpe.ts → customization-implementation/dummyConfig.ts} +4 -4
- package/template/customization-implementation/index.ts +4 -0
- package/template/{fpe-api/useFpe.tsx → customization-implementation/useCustomization.tsx} +12 -12
- package/template/{fpe.config.js → customization.config.js} +11 -11
- package/template/electron/main/index.js +42 -35
- package/template/esbuild.rsdk.go +8 -17
- package/template/global.d.ts +4 -3
- package/template/index.rsdk.tsx +13 -5
- package/template/index.wsdk.tsx +21 -5
- package/template/package.json +3 -0
- package/template/react-native-toast-message/src/index.js +3 -7
- package/template/react-native-toast-message/src/{index.wsdk.js → index.sdk.tsx} +1 -1
- package/template/react-native-toast-message/src/styles.sdk.ts +17 -0
- package/template/src/App.tsx +8 -4
- package/template/src/AppWrapper.tsx +8 -6
- package/template/src/SDKAppWrapper.tsx +28 -21
- package/template/src/app-state/useLocalUserInfo.ts +8 -0
- package/template/src/app-state/useMessages.ts +52 -0
- package/template/src/atoms/PrimaryButton.tsx +2 -2
- package/template/src/atoms/SecondaryButton.tsx +12 -4
- package/template/src/atoms/TextInput.tsx +2 -2
- package/template/src/components/Chat.tsx +22 -11
- package/template/src/components/ChatContext.ts +10 -27
- package/template/src/components/Controls.native.tsx +13 -7
- package/template/src/components/Controls.tsx +15 -24
- package/template/src/components/DeviceConfigure.tsx +4 -3
- package/template/src/components/EventsConfigure.tsx +54 -0
- package/template/src/components/GridVideo.tsx +5 -6
- package/template/src/components/HostControlView.tsx +13 -19
- package/template/src/components/Navbar.tsx +54 -41
- package/template/src/components/NetworkQualityContext.tsx +4 -3
- package/template/src/components/ParticipantsView.tsx +7 -7
- package/template/src/components/PinnedVideo.tsx +3 -4
- package/template/src/components/Precall.native.tsx +3 -3
- package/template/src/components/Precall.tsx +14 -10
- package/template/src/components/RTMConfigure.tsx +61 -219
- package/template/src/components/SettingsView.tsx +6 -3
- package/template/src/components/Share.tsx +24 -18
- package/template/src/components/chat-messages/useChatMessages.tsx +397 -80
- package/template/src/components/chat-notification/useChatNotification.tsx +2 -2
- package/template/src/components/chat-ui/useChatUIControl.tsx +1 -1
- package/template/src/components/common/Logo.tsx +3 -2
- package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
- package/template/src/components/contexts/ScreenShareContext.tsx +3 -1
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +85 -0
- package/template/src/components/contexts/WhiteboardContext.tsx +8 -8
- package/template/src/components/livestream/LiveStreamContext.tsx +88 -74
- package/template/src/components/meeting-info/useMeetingInfo.tsx +23 -19
- package/template/src/components/meeting-info/useSetMeetingInfo.tsx +1 -1
- package/template/src/components/participants/AllAudienceParticipants.tsx +2 -2
- package/template/src/components/participants/AllHostParticipants.tsx +4 -4
- package/template/src/components/participants/MeParticipant.tsx +5 -3
- package/template/src/components/participants/ParticipantName.tsx +2 -2
- package/template/src/components/participants/RemoteParticipants.tsx +9 -7
- package/template/src/components/precall/LocalMute.native.tsx +14 -10
- package/template/src/components/precall/LocalMute.tsx +7 -5
- package/template/src/components/precall/VideoPreview.native.tsx +6 -6
- package/template/src/components/precall/VideoPreview.tsx +3 -3
- package/template/src/components/precall/joinCallBtn.tsx +3 -3
- package/template/src/components/precall/meetingTitle.tsx +3 -1
- package/template/src/components/precall/selectDevice.tsx +2 -2
- package/template/src/components/precall/usePreCall.tsx +1 -1
- package/template/src/components/styles.ts +3 -3
- package/template/src/components/useShareLink.tsx +69 -29
- package/template/src/components/useUserPreference.tsx +16 -15
- package/template/src/components/useWakeLock.tsx +3 -3
- package/template/src/language/i18nTypes.ts +1 -1
- package/template/src/language/index.ts +2 -2
- package/template/src/language/useLanguage.tsx +2 -3
- package/template/src/pages/Authenticate.tsx +3 -2
- package/template/src/pages/Create.tsx +18 -20
- package/template/src/pages/Join.tsx +6 -7
- package/template/src/pages/VideoCall.tsx +74 -66
- package/template/src/pages/create/useCreate.tsx +1 -1
- package/template/src/pages/video-call/CustomUserContextHolder.tsx +14 -6
- package/template/src/pages/video-call/DefaultLayouts.ts +8 -8
- package/template/src/pages/video-call/{NameWithMicStatus.tsx → NameWithMicIcon.tsx} +8 -1
- package/template/src/pages/video-call/RenderComponent.tsx +7 -10
- package/template/src/pages/video-call/VideoCallScreen.tsx +31 -22
- package/template/src/pages/video-call/VideoComponent.tsx +13 -15
- package/template/src/pages/video-call/VideoRenderer.tsx +6 -6
- package/template/src/pages/video-call/useLayoutsData.ts +23 -0
- package/template/src/rtm/RTMEngine.ts +13 -0
- package/template/src/rtm-events/EventUtils.ts +20 -20
- package/template/src/rtm-events/EventsQueue.ts +9 -3
- package/template/src/rtm-events/constants.ts +5 -0
- package/template/src/rtm-events/index.tsx +1 -3
- package/template/src/{custom-events/CustomEvents.ts → rtm-events-api/Events.ts} +67 -61
- package/template/src/rtm-events-api/index.tsx +6 -0
- package/template/src/rtm-events-api/types.ts +22 -0
- package/template/src/subComponents/ChatBubble.tsx +24 -8
- package/template/src/subComponents/ChatContainer.tsx +24 -15
- package/template/src/subComponents/ChatInput.tsx +56 -42
- package/template/src/subComponents/LanguageSelector.tsx +2 -2
- package/template/src/subComponents/LayoutIconDropdown.native.tsx +5 -5
- package/template/src/subComponents/LayoutIconDropdown.tsx +7 -7
- package/template/src/subComponents/LocalAudioMute.tsx +3 -4
- package/template/src/subComponents/LocalEndCall.tsx +3 -6
- package/template/src/subComponents/LocalSwitchCamera.tsx +3 -4
- package/template/src/subComponents/LocalVideoMute.tsx +3 -3
- package/template/src/subComponents/NetworkQualityPill.tsx +8 -9
- package/template/src/subComponents/OpenInNativeButton.tsx +2 -3
- package/template/src/subComponents/RemoteAudioMute.tsx +5 -11
- package/template/src/subComponents/RemoteEndCall.tsx +3 -10
- package/template/src/subComponents/RemoteVideoMute.tsx +3 -10
- package/template/src/subComponents/SelectDevice.tsx +1 -1
- package/template/src/subComponents/SelectOAuth.tsx +3 -2
- package/template/src/subComponents/SidePanelButtons.ts +6 -5
- package/template/src/subComponents/TextWithTooltip.tsx +6 -2
- package/template/src/subComponents/{toastConfig.tsx → ToastConfig.tsx} +2 -2
- package/template/src/subComponents/chat/ChatParticipants.tsx +6 -5
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +2 -2
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +4 -3
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +2 -2
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +2 -4
- package/template/src/subComponents/livestream/index.ts +2 -2
- package/template/src/subComponents/recording/useRecording.tsx +44 -23
- package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +11 -5
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +46 -34
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +97 -38
- package/template/src/subComponents/screenshare/useScreenshare.tsx +1 -1
- package/template/src/utils/SdkEvents.ts +9 -46
- package/template/src/utils/common.tsx +25 -9
- package/template/src/utils/getUniqueID.ts +5 -0
- package/template/src/utils/isMobileOrTablet.native.ts +2 -2
- package/template/src/utils/isMobileOrTablet.ts +21 -8
- package/template/src/utils/useButtonTemplate.tsx +1 -1
- package/template/src/utils/useCreateMeeting.ts +21 -10
- package/template/src/utils/useGetMeetingPhrase.ts +11 -8
- package/template/src/utils/{IsAttendeeUser.ts → useIsAttendee.ts} +3 -1
- package/template/src/utils/{isAudioEnabled.ts → useIsAudioEnabled.ts} +4 -4
- package/template/src/utils/{isHostUser.ts → useIsHost.ts} +13 -16
- package/template/src/utils/{isPSTNUser.ts → useIsPSTN.ts} +2 -2
- package/template/src/utils/{isScreenShareUser.ts → useIsScreenShare.ts} +0 -0
- package/template/src/utils/{isVideoEnabled.ts → useIsVideoEnabled.ts} +5 -6
- package/template/src/utils/useJoinMeeting.ts +8 -6
- package/template/src/utils/useLayout.tsx +5 -5
- package/template/src/utils/useMutePSTN.ts +5 -3
- package/template/src/utils/useMuteToggleLocal.ts +3 -4
- package/template/src/utils/useRemoteEndCall.ts +11 -10
- package/template/src/utils/useRemoteMute.ts +42 -20
- package/template/src/utils/useSidePanel.tsx +1 -1
- package/template/src/utils/useString.ts +2 -2
- package/template/src/utils/useUserName.ts +11 -0
- package/template/tsconfig_fpeApi.json +8 -9
- package/template/tsconfig_rsdk_index.json +8 -9
- package/template/tsconfig_wsdk_index.json +8 -9
- package/template/webpack.commons.js +9 -9
- package/template/webpack.rsdk.config.js +4 -2
- package/template/webpack.ts.config.js +6 -6
- package/template/webpack.wsdk.config.js +2 -1
- package/template/fpe-api/fpeEvents.ts +0 -9
- package/template/fpe-api/utils.ts +0 -61
- package/template/fpe-implementation/index.ts +0 -1
- package/template/fpe-todo.txt +0 -14
- package/template/src/components/RTMEvents.tsx +0 -84
- package/template/src/custom-events/index.tsx +0 -4
- package/template/src/custom-events/types.ts +0 -51
- package/template/src/pages/video-call/CustomLayout.ts +0 -17
- package/template/src/rtm-events/types.ts +0 -7
- package/template/src/utils/getMeetingInvite.ts +0 -53
- package/template/src/utils/useGroupMessages.ts +0 -24
- package/template/src/utils/useNavParams.ts +0 -6
- package/template/src/utils/useNavigateTo.ts +0 -8
- package/template/src/utils/usePrivateMessages.ts +0 -33
- package/template/src/utils/useSendControlMessage.ts +0 -51
- package/template/src/utils/useSendMessage.ts +0 -40
- package/template/src/utils/useSetUnreadMessageCount.ts +0 -43
- package/template/src/utils/useUnreadMessageCount.ts +0 -50
- package/template/src/utils/useUserList.ts +0 -26
|
@@ -11,69 +11,47 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// @ts-nocheck
|
|
13
13
|
import React, {useState, useContext, useEffect, useRef} from 'react';
|
|
14
|
-
import RtmEngine
|
|
14
|
+
import RtmEngine from 'agora-react-native-rtm';
|
|
15
15
|
import {PropsContext, useLocalUid} from '../../agora-rn-uikit';
|
|
16
|
-
import ChatContext
|
|
16
|
+
import ChatContext from './ChatContext';
|
|
17
17
|
import {RtcContext} from '../../agora-rn-uikit';
|
|
18
|
-
import {messageSourceType, messageActionType} from './ChatContext';
|
|
19
18
|
import {Platform} from 'react-native';
|
|
20
19
|
import {backOff} from 'exponential-backoff';
|
|
21
20
|
import {useString} from '../utils/useString';
|
|
22
|
-
import {isAndroid,
|
|
23
|
-
import
|
|
24
|
-
import {useRenderContext} from 'fpe-api';
|
|
21
|
+
import {isAndroid, isWebInternal} from '../utils/common';
|
|
22
|
+
import {useRender, useRtc} from 'customization-api';
|
|
25
23
|
import {
|
|
26
24
|
safeJsonParse,
|
|
27
25
|
timeNow,
|
|
28
26
|
hasJsonStructure,
|
|
29
27
|
getMessageTime,
|
|
30
28
|
get32BitUid,
|
|
31
|
-
adjustUID,
|
|
32
29
|
} from '../rtm/utils';
|
|
33
|
-
import {EventUtils, EventsQueue
|
|
30
|
+
import {EventUtils, EventsQueue} from '../rtm-events';
|
|
31
|
+
import {EventPersistLevel} from '../rtm-events-api';
|
|
34
32
|
import RTMEngine from '../rtm/RTMEngine';
|
|
35
33
|
import {filterObject} from '../utils';
|
|
36
|
-
import CustomEvents, {EventLevel} from '../custom-events';
|
|
37
|
-
import {EventNames} from '../rtm-events';
|
|
38
|
-
import useLocalScreenShareUid from '../utils/useLocalShareScreenUid';
|
|
39
34
|
|
|
40
35
|
export enum UserType {
|
|
41
36
|
ScreenShare = 'screenshare',
|
|
42
37
|
}
|
|
43
38
|
|
|
44
|
-
const stringifyPayload = (
|
|
45
|
-
source: messageSourceType,
|
|
46
|
-
type: messageActionType,
|
|
47
|
-
msg: string,
|
|
48
|
-
) => {
|
|
49
|
-
return JSON.stringify({
|
|
50
|
-
source,
|
|
51
|
-
type,
|
|
52
|
-
msg,
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const parsePayload = (data: string) => {
|
|
57
|
-
return JSON.parse(data);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
39
|
const RtmConfigure = (props: any) => {
|
|
61
40
|
const localUid = useLocalUid();
|
|
62
|
-
const screenShareUid = useLocalScreenShareUid();
|
|
63
41
|
const {callActive} = props;
|
|
64
42
|
const {rtcProps} = useContext(PropsContext);
|
|
65
|
-
const {RtcEngine, dispatch} =
|
|
66
|
-
const {renderList,
|
|
43
|
+
const {RtcEngine, dispatch} = useRtc();
|
|
44
|
+
const {renderList, activeUids} = useRender();
|
|
67
45
|
const renderListRef = useRef({renderList: renderList});
|
|
68
|
-
const
|
|
46
|
+
const activeUidsRef = useRef({activeUids: activeUids});
|
|
69
47
|
|
|
70
48
|
/**
|
|
71
49
|
* inside event callback state won't have latest value.
|
|
72
50
|
* so creating ref to access the state
|
|
73
51
|
*/
|
|
74
52
|
useEffect(() => {
|
|
75
|
-
|
|
76
|
-
}, [
|
|
53
|
+
activeUidsRef.current.activeUids = activeUids;
|
|
54
|
+
}, [activeUids]);
|
|
77
55
|
|
|
78
56
|
useEffect(() => {
|
|
79
57
|
renderListRef.current.renderList = renderList;
|
|
@@ -108,7 +86,7 @@ const RtmConfigure = (props: any) => {
|
|
|
108
86
|
engine.current.leaveChannel(rtcProps.channel);
|
|
109
87
|
};
|
|
110
88
|
|
|
111
|
-
if (!
|
|
89
|
+
if (!isWebInternal()) return;
|
|
112
90
|
window.addEventListener('beforeunload', handBrowserClose);
|
|
113
91
|
// cleanup this component
|
|
114
92
|
return () => {
|
|
@@ -139,7 +117,9 @@ const RtmConfigure = (props: any) => {
|
|
|
139
117
|
try {
|
|
140
118
|
await engine.current.setLocalUserAttributes(rtmAttributes);
|
|
141
119
|
timerValueRef.current = 5;
|
|
142
|
-
joinChannel();
|
|
120
|
+
await joinChannel();
|
|
121
|
+
setHasUserJoinedRTM(true);
|
|
122
|
+
await runQueuedEvents();
|
|
143
123
|
} catch (error) {
|
|
144
124
|
setTimeout(async () => {
|
|
145
125
|
timerValueRef.current = timerValueRef.current + timerValueRef.current;
|
|
@@ -153,8 +133,6 @@ const RtmConfigure = (props: any) => {
|
|
|
153
133
|
await engine.current.joinChannel(rtcProps.channel);
|
|
154
134
|
timerValueRef.current = 5;
|
|
155
135
|
await getMembers();
|
|
156
|
-
setHasUserJoinedRTM(true);
|
|
157
|
-
await runQueuedCustomEvents();
|
|
158
136
|
} catch (error) {
|
|
159
137
|
setTimeout(async () => {
|
|
160
138
|
timerValueRef.current = timerValueRef.current + timerValueRef.current;
|
|
@@ -233,18 +211,11 @@ const RtmConfigure = (props: any) => {
|
|
|
233
211
|
// isActive to identify all active screenshare users in the call
|
|
234
212
|
for (const [key, value] of Object.entries(attr?.attributes)) {
|
|
235
213
|
if (hasJsonStructure(value as string)) {
|
|
236
|
-
const [err, result] = safeJsonParse(value as string);
|
|
237
|
-
const payloadValue = result?.value || '';
|
|
238
|
-
const payloadAction = result?.action || '';
|
|
239
214
|
const data = {
|
|
240
215
|
evt: key,
|
|
241
|
-
|
|
242
|
-
...result,
|
|
243
|
-
value: payloadValue,
|
|
244
|
-
action: payloadAction,
|
|
245
|
-
},
|
|
216
|
+
value: value,
|
|
246
217
|
};
|
|
247
|
-
//
|
|
218
|
+
// TODOSUP: Add the data to queue, dont add same mulitple events, use set so as to not repeat events
|
|
248
219
|
EventsQueue.enqueue({
|
|
249
220
|
data: data,
|
|
250
221
|
uid: member.uid,
|
|
@@ -337,225 +308,100 @@ const RtmConfigure = (props: any) => {
|
|
|
337
308
|
// Chat of left user becomes undefined. So don't cleanup
|
|
338
309
|
const uid = data?.uid ? parseInt(data?.uid) : undefined;
|
|
339
310
|
if (!uid) return;
|
|
340
|
-
//updating the rtc data
|
|
311
|
+
// updating the rtc data
|
|
341
312
|
updateRenderListState(uid, {
|
|
342
313
|
offline: true,
|
|
343
314
|
});
|
|
344
315
|
});
|
|
345
316
|
|
|
346
317
|
engine.current.on('messageReceived', (evt: any) => {
|
|
318
|
+
console.log('CUSTOM_EVENT_API messageReceived: ', evt);
|
|
347
319
|
const {peerId, ts, text} = evt;
|
|
348
|
-
const
|
|
349
|
-
|
|
320
|
+
const [err, msg] = safeJsonParse(text);
|
|
321
|
+
if (err) {
|
|
322
|
+
console.log(
|
|
323
|
+
'CUSTOM_EVENT_API: JSON payload incorrect, Error while parsing the payload',
|
|
324
|
+
);
|
|
325
|
+
}
|
|
350
326
|
|
|
351
327
|
const timestamp = getMessageTime(ts);
|
|
352
328
|
|
|
353
|
-
const sender = isAndroid ? get32BitUid(peerId) : peerId;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
dispatch({
|
|
360
|
-
type: 'LocalMuteVideo',
|
|
361
|
-
value: [0],
|
|
362
|
-
});
|
|
363
|
-
break;
|
|
364
|
-
case controlMessageEnum.muteAudio:
|
|
365
|
-
RtcEngine.muteLocalAudioStream(true);
|
|
366
|
-
dispatch({
|
|
367
|
-
type: 'LocalMuteAudio',
|
|
368
|
-
value: [0],
|
|
369
|
-
});
|
|
370
|
-
break;
|
|
371
|
-
case controlMessageEnum.kickUser:
|
|
372
|
-
dispatch({
|
|
373
|
-
type: 'EndCall',
|
|
374
|
-
value: [],
|
|
375
|
-
});
|
|
376
|
-
break;
|
|
377
|
-
default:
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
} else if (type === eventMessageType.CUSTOM_EVENT) {
|
|
381
|
-
console.log('CUSTOM_EVENT_API: inside custom event type ', evt);
|
|
382
|
-
try {
|
|
383
|
-
customEventDispatcher(msg, sender, timestamp);
|
|
384
|
-
} catch (error) {
|
|
385
|
-
console.log('error while dispacthing', error);
|
|
386
|
-
}
|
|
329
|
+
const sender = isAndroid() ? get32BitUid(peerId) : parseInt(peerId);
|
|
330
|
+
|
|
331
|
+
try {
|
|
332
|
+
eventDispatcher(msg, sender, timestamp);
|
|
333
|
+
} catch (error) {
|
|
334
|
+
console.log('error while dispacthing', error);
|
|
387
335
|
}
|
|
388
336
|
});
|
|
389
337
|
|
|
390
338
|
engine.current.on('channelMessageReceived', (evt) => {
|
|
339
|
+
console.log('CUSTOM_EVENT_API channelMessageReceived: ', evt);
|
|
340
|
+
|
|
391
341
|
const {uid, channelId, text, ts} = evt;
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
342
|
+
const [err, msg] = safeJsonParse(text);
|
|
343
|
+
if (err) {
|
|
344
|
+
console.log(
|
|
345
|
+
'CUSTOM_EVENT_API: JSON payload incorrect, Error while parsing the payload',
|
|
346
|
+
);
|
|
347
|
+
}
|
|
395
348
|
|
|
396
349
|
const timestamp = getMessageTime(ts);
|
|
397
350
|
|
|
398
|
-
const sender = Platform.OS ? get32BitUid(uid) : uid;
|
|
351
|
+
const sender = Platform.OS ? get32BitUid(uid) : parseInt(uid);
|
|
399
352
|
|
|
400
353
|
if (channelId === rtcProps.channel) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
let actionMsg = '';
|
|
406
|
-
if (hasJsonStructure(msg)) {
|
|
407
|
-
const [err, result] = safeJsonParse(msg);
|
|
408
|
-
if (!err) {
|
|
409
|
-
const {action} = result;
|
|
410
|
-
actionMsg = action;
|
|
411
|
-
}
|
|
412
|
-
} else {
|
|
413
|
-
actionMsg = msg;
|
|
414
|
-
}
|
|
415
|
-
switch (actionMsg) {
|
|
416
|
-
case controlMessageEnum.muteVideo:
|
|
417
|
-
RtcEngine.muteLocalVideoStream(true);
|
|
418
|
-
dispatch({
|
|
419
|
-
type: 'LocalMuteVideo',
|
|
420
|
-
value: [0],
|
|
421
|
-
});
|
|
422
|
-
break;
|
|
423
|
-
case controlMessageEnum.muteAudio:
|
|
424
|
-
RtcEngine.muteLocalAudioStream(true);
|
|
425
|
-
dispatch({
|
|
426
|
-
type: 'LocalMuteAudio',
|
|
427
|
-
value: [0],
|
|
428
|
-
});
|
|
429
|
-
break;
|
|
430
|
-
default:
|
|
431
|
-
break;
|
|
432
|
-
// throw new Error('Unsupported message type');
|
|
433
|
-
}
|
|
434
|
-
} else if (type === eventMessageType.CUSTOM_EVENT) {
|
|
435
|
-
console.log('CUSTOM_EVENT_API: inside custom event type ', evt);
|
|
436
|
-
try {
|
|
437
|
-
customEventDispatcher(msg, sender, timestamp);
|
|
438
|
-
} catch (error) {
|
|
439
|
-
console.log('error while dispacthing', error);
|
|
440
|
-
}
|
|
354
|
+
try {
|
|
355
|
+
eventDispatcher(msg, sender, timestamp);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
console.log('error while dispacthing', error);
|
|
441
358
|
}
|
|
442
359
|
}
|
|
443
360
|
});
|
|
444
361
|
doLoginAndSetupRTM();
|
|
445
362
|
};
|
|
446
363
|
|
|
447
|
-
const
|
|
364
|
+
const runQueuedEvents = async () => {
|
|
448
365
|
try {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
await customEventDispatcher(
|
|
453
|
-
queuedEvents.data,
|
|
454
|
-
queuedEvents.uid,
|
|
455
|
-
queuedEvents.ts,
|
|
456
|
-
);
|
|
457
|
-
// EventsQueue.dequeue();
|
|
458
|
-
}
|
|
366
|
+
while (!EventsQueue.isEmpty()) {
|
|
367
|
+
const currEvt = EventsQueue.dequeue();
|
|
368
|
+
await eventDispatcher(currEvt.data, currEvt.uid, currEvt.ts);
|
|
459
369
|
}
|
|
460
370
|
} catch (error) {
|
|
461
|
-
|
|
462
|
-
'CUSTOM_EVENTS_API: error while running queued events ',
|
|
463
|
-
error,
|
|
464
|
-
);
|
|
371
|
+
console.log('CUSTOM_EVENT_API: error while running queue events', error);
|
|
465
372
|
}
|
|
466
373
|
};
|
|
467
374
|
|
|
468
|
-
const
|
|
375
|
+
const eventDispatcher = async (
|
|
469
376
|
data: {
|
|
470
377
|
evt: string;
|
|
471
|
-
|
|
472
|
-
level: 1 | 2 | 3;
|
|
473
|
-
action: string;
|
|
474
|
-
value: string;
|
|
475
|
-
};
|
|
378
|
+
value: string;
|
|
476
379
|
},
|
|
477
380
|
sender: string,
|
|
478
381
|
ts: number,
|
|
479
382
|
) => {
|
|
480
|
-
console.log('CUSTOM_EVENT_API: inside
|
|
481
|
-
const {evt,
|
|
383
|
+
console.log('CUSTOM_EVENT_API: inside eventDispatcher ', data);
|
|
384
|
+
const {evt, value} = data;
|
|
482
385
|
// Step 1: Set local attributes
|
|
483
|
-
if (
|
|
484
|
-
const rtmAttribute = {key: evt, value:
|
|
386
|
+
if (value?.persistLevel === EventPersistLevel.LEVEL3) {
|
|
387
|
+
const rtmAttribute = {key: evt, value: value};
|
|
485
388
|
await engine.current.addOrUpdateLocalUserAttributes([rtmAttribute]);
|
|
486
389
|
}
|
|
487
390
|
// Step 2: Emit the event
|
|
488
391
|
try {
|
|
489
|
-
|
|
490
|
-
|
|
392
|
+
const {payload, persistLevel, source} = JSON.parse(value);
|
|
393
|
+
console.log('CUSTOM_EVENT_API: emiting event..: ');
|
|
394
|
+
EventUtils.emitEvent(evt, source, {payload, persistLevel, sender, ts});
|
|
491
395
|
} catch (error) {
|
|
492
396
|
console.log('CUSTOM_EVENT_API: error while emiting event: ', error);
|
|
493
397
|
}
|
|
494
398
|
};
|
|
495
399
|
|
|
496
|
-
const sendMessage = async (msg: string) => {
|
|
497
|
-
if (msg.trim() === '') return;
|
|
498
|
-
const text = stringifyPayload(
|
|
499
|
-
messageSourceType.Core,
|
|
500
|
-
messageActionType.Normal,
|
|
501
|
-
msg,
|
|
502
|
-
);
|
|
503
|
-
await (engine.current as RtmEngine).sendMessageByChannelId(
|
|
504
|
-
rtcProps.channel,
|
|
505
|
-
text,
|
|
506
|
-
);
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const sendMessageToUid = async (msg: string, uid: UidType) => {
|
|
510
|
-
if (msg.trim() === '') return;
|
|
511
|
-
|
|
512
|
-
const adjustedUID = adjustUID(uid);
|
|
513
|
-
|
|
514
|
-
const text = stringifyPayload(
|
|
515
|
-
messageSourceType.Core,
|
|
516
|
-
messageActionType.Normal,
|
|
517
|
-
msg,
|
|
518
|
-
);
|
|
519
|
-
await (engine.current as RtmEngine).sendMessageToPeer({
|
|
520
|
-
peerId: adjustedUID.toString(),
|
|
521
|
-
offline: false,
|
|
522
|
-
text,
|
|
523
|
-
});
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
const sendControlMessage = async (msg: string) => {
|
|
527
|
-
const text = stringifyPayload(
|
|
528
|
-
messageSourceType.Core,
|
|
529
|
-
messageActionType.Control,
|
|
530
|
-
msg,
|
|
531
|
-
);
|
|
532
|
-
await (engine.current as RtmEngine).sendMessageByChannelId(
|
|
533
|
-
rtcProps.channel,
|
|
534
|
-
text,
|
|
535
|
-
);
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
const sendControlMessageToUid = async (msg: string, uid: UidType) => {
|
|
539
|
-
if (msg.trim() === '') return;
|
|
540
|
-
|
|
541
|
-
const adjustedUID = adjustUID(uid);
|
|
542
|
-
|
|
543
|
-
const text = stringifyPayload(
|
|
544
|
-
messageSourceType.Core,
|
|
545
|
-
messageActionType.Control,
|
|
546
|
-
msg,
|
|
547
|
-
);
|
|
548
|
-
await (engine.current as RtmEngine).sendMessageToPeer({
|
|
549
|
-
peerId: adjustedUID.toString(),
|
|
550
|
-
offline: false,
|
|
551
|
-
text,
|
|
552
|
-
});
|
|
553
|
-
};
|
|
554
|
-
|
|
555
400
|
const end = async () => {
|
|
556
401
|
callActive
|
|
557
|
-
? (
|
|
558
|
-
|
|
402
|
+
? (RTMEngine.getInstance().destroy(),
|
|
403
|
+
EventUtils.clear(),
|
|
404
|
+
setHasUserJoinedRTM(false),
|
|
559
405
|
// setLogin(false),
|
|
560
406
|
console.log('RTM cleanup done'))
|
|
561
407
|
: {};
|
|
@@ -573,10 +419,6 @@ const RtmConfigure = (props: any) => {
|
|
|
573
419
|
<ChatContext.Provider
|
|
574
420
|
value={{
|
|
575
421
|
hasUserJoinedRTM,
|
|
576
|
-
sendControlMessage,
|
|
577
|
-
sendControlMessageToUid,
|
|
578
|
-
sendMessage,
|
|
579
|
-
sendMessageToUid,
|
|
580
422
|
engine: engine.current,
|
|
581
423
|
localUid: localUid,
|
|
582
424
|
onlineUsersCount,
|
|
@@ -15,17 +15,20 @@ import SelectDevice from '../subComponents/SelectDevice';
|
|
|
15
15
|
import HostControlView from './HostControlView';
|
|
16
16
|
import {useString} from '../utils/useString';
|
|
17
17
|
import LanguageSelector from '../subComponents/LanguageSelector';
|
|
18
|
-
import {
|
|
18
|
+
import {isWebInternal} from '../utils/common';
|
|
19
19
|
import {useMeetingInfo} from './meeting-info/useMeetingInfo';
|
|
20
20
|
|
|
21
21
|
const SettingsView = () => {
|
|
22
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
data: {isHost},
|
|
24
|
+
} = useMeetingInfo();
|
|
23
25
|
//commented for v1 release
|
|
24
26
|
//const selectInputDeviceLabel = useString('selectInputDeviceLabel')();
|
|
25
27
|
const selectInputDeviceLabel = 'Select Input Device';
|
|
26
28
|
|
|
27
29
|
return (
|
|
28
|
-
<View
|
|
30
|
+
<View
|
|
31
|
+
style={isWebInternal() ? style.settingsView : style.settingsViewNative}>
|
|
29
32
|
<View style={style.main}>
|
|
30
33
|
<View>
|
|
31
34
|
<Text style={style.heading}>{selectInputDeviceLabel}</Text>
|
|
@@ -21,12 +21,12 @@ import {useString} from '../utils/useString';
|
|
|
21
21
|
import isSDKCheck from '../utils/isSDK';
|
|
22
22
|
import Logo from '../components/common/Logo';
|
|
23
23
|
import {useMeetingInfo} from './meeting-info/useMeetingInfo';
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
24
|
+
import {useHistory} from '../components/Router';
|
|
25
|
+
import {useCustomization} from 'customization-implementation';
|
|
26
26
|
import {isValidReactComponent} from '../utils/common';
|
|
27
27
|
|
|
28
28
|
const Share = () => {
|
|
29
|
-
const {FpeShareComponent} =
|
|
29
|
+
const {FpeShareComponent} = useCustomization((data) => {
|
|
30
30
|
let components: {
|
|
31
31
|
FpeShareComponent?: React.ElementType;
|
|
32
32
|
} = {};
|
|
@@ -45,7 +45,9 @@ const Share = () => {
|
|
|
45
45
|
return components;
|
|
46
46
|
});
|
|
47
47
|
const {copyShareLinkToClipboard, getShareLink} = useShareLink();
|
|
48
|
-
const {
|
|
48
|
+
const {
|
|
49
|
+
data: {roomId, pstn, isSeparateHostLink},
|
|
50
|
+
} = useMeetingInfo();
|
|
49
51
|
//commented for v1 release
|
|
50
52
|
// const meetingUrlText = useString('meetingUrlLabel')();
|
|
51
53
|
// const meetingIdText = useString('meetingIdLabel')();
|
|
@@ -71,10 +73,10 @@ const Share = () => {
|
|
|
71
73
|
const pinLabel = 'Pin';
|
|
72
74
|
const enterMeetingAfterCreateButton = 'Start Meeting (as host)';
|
|
73
75
|
const copyInviteButton = 'Copy invite to clipboard';
|
|
74
|
-
const
|
|
76
|
+
const history = useHistory();
|
|
75
77
|
const enterMeeting = () => {
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
+
if (roomId?.host) {
|
|
79
|
+
history.push(roomId.host);
|
|
78
80
|
}
|
|
79
81
|
};
|
|
80
82
|
|
|
@@ -87,18 +89,20 @@ const Share = () => {
|
|
|
87
89
|
setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
|
|
88
90
|
};
|
|
89
91
|
const isSDK = isSDKCheck();
|
|
90
|
-
const
|
|
92
|
+
const isWebCheck =
|
|
93
|
+
$config.FRONTEND_ENDPOINT || (platform === 'web' && !isSDK);
|
|
91
94
|
|
|
92
|
-
const getAttendeeLabel = () =>
|
|
95
|
+
const getAttendeeLabel = () =>
|
|
96
|
+
isWebCheck ? attendeeUrlLabel : attendeeIdLabel;
|
|
93
97
|
|
|
94
98
|
const getHostLabel = () => {
|
|
95
99
|
if (isSeparateHostLink) {
|
|
96
|
-
if (
|
|
100
|
+
if (isWebCheck) {
|
|
97
101
|
return hostUrlLabel;
|
|
98
102
|
}
|
|
99
103
|
return hostIdText;
|
|
100
104
|
} else {
|
|
101
|
-
if (
|
|
105
|
+
if (isWebCheck) {
|
|
102
106
|
return meetingUrlText;
|
|
103
107
|
}
|
|
104
108
|
return meetingIdText;
|
|
@@ -118,7 +122,7 @@ const Share = () => {
|
|
|
118
122
|
<View style={{width: '80%'}}>
|
|
119
123
|
<Text style={style.urlTitle}>{getAttendeeLabel()}</Text>
|
|
120
124
|
<View style={style.urlHolder}>
|
|
121
|
-
<Text style={[style.url,
|
|
125
|
+
<Text style={[style.url, isWebCheck ? urlWeb : {opacity: 1}]}>
|
|
122
126
|
{getShareLink(SHARE_LINK_CONTENT_TYPE.ATTENDEE)}
|
|
123
127
|
</Text>
|
|
124
128
|
</View>
|
|
@@ -156,7 +160,7 @@ const Share = () => {
|
|
|
156
160
|
<View style={{width: '80%'}}>
|
|
157
161
|
<Text style={style.urlTitle}>{getHostLabel()}</Text>
|
|
158
162
|
<View style={style.urlHolder}>
|
|
159
|
-
<Text style={[style.url,
|
|
163
|
+
<Text style={[style.url, isWebCheck ? urlWeb : {opacity: 1}]}>
|
|
160
164
|
{getShareLink(SHARE_LINK_CONTENT_TYPE.HOST)}
|
|
161
165
|
</Text>
|
|
162
166
|
</View>
|
|
@@ -187,21 +191,23 @@ const Share = () => {
|
|
|
187
191
|
</View>
|
|
188
192
|
</View>
|
|
189
193
|
</View>
|
|
190
|
-
{
|
|
194
|
+
{pstn ? (
|
|
191
195
|
<View style={style.urlContainer}>
|
|
192
196
|
<View style={{width: '80%'}}>
|
|
193
197
|
<Text style={style.urlTitle}>{pstnLabel}</Text>
|
|
194
198
|
<View>
|
|
195
199
|
<View style={style.pstnHolder}>
|
|
196
200
|
<Text style={style.urlTitle}>{pstnNumberLabel}: </Text>
|
|
197
|
-
<Text
|
|
198
|
-
{
|
|
201
|
+
<Text
|
|
202
|
+
style={[style.url, isWebCheck ? urlWeb : {opacity: 1}]}>
|
|
203
|
+
{pstn?.number}
|
|
199
204
|
</Text>
|
|
200
205
|
</View>
|
|
201
206
|
<View style={style.pstnHolder}>
|
|
202
207
|
<Text style={style.urlTitle}>{pinLabel}: </Text>
|
|
203
|
-
<Text
|
|
204
|
-
{
|
|
208
|
+
<Text
|
|
209
|
+
style={[style.url, isWebCheck ? urlWeb : {opacity: 1}]}>
|
|
210
|
+
{pstn?.pin}
|
|
205
211
|
</Text>
|
|
206
212
|
</View>
|
|
207
213
|
</View>
|