agora-appbuilder-core 2.3.0-beta.2 → 2.3.0-beta.22
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 +2 -2
- package/template/Gulpfile.js +112 -13
- package/template/_package-lock.json +13011 -13288
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
- 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/Reducer/UserJoined.ts +3 -1
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +64 -33
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +11 -2
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +23 -4
- package/template/agora-rn-uikit/src/Utils/permission.ts +17 -6
- package/template/bridge/rtc/webNg/RtcEngine.ts +51 -26
- package/template/esbuild.rsdk.go +20 -6
- package/template/fpe-api/components.ts +15 -0
- package/template/fpe-api/context.ts +2 -3
- package/template/fpe-api/install.ts +19 -9
- package/template/fpe-api/typeDefinition.ts +7 -6
- package/template/fpe-api/utils.ts +32 -25
- package/template/global.d.ts +3 -2
- package/template/index.rsdk.tsx +15 -4
- package/template/index.wsdk.tsx +13 -3
- package/template/package.json +4 -2
- 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/SDKAppWrapper.tsx +1 -1
- package/template/src/components/Chat.tsx +23 -5
- package/template/src/components/ChatContext.ts +15 -4
- package/template/src/components/Controls.native.tsx +10 -6
- package/template/src/components/Controls.tsx +6 -4
- package/template/src/components/HostControlView.tsx +5 -3
- package/template/src/components/Navbar.tsx +15 -13
- package/template/src/components/RTMConfigure.tsx +20 -50
- package/template/src/components/chat-messages/useChatMessages.tsx +369 -70
- package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
- package/template/src/components/contexts/ScreenShareContext.tsx +2 -0
- package/template/src/components/livestream/LiveStreamContext.tsx +9 -6
- package/template/src/components/participants/MeParticipant.tsx +5 -3
- package/template/src/components/participants/RemoteParticipants.tsx +9 -7
- package/template/src/components/precall/LocalMute.native.tsx +12 -8
- package/template/src/components/precall/LocalMute.tsx +5 -3
- package/template/src/components/precall/textInput.tsx +1 -1
- package/template/src/components/useShareLink.tsx +37 -39
- package/template/src/components/useUserPreference.tsx +125 -0
- package/template/src/custom-events/CustomEvents.ts +39 -23
- package/template/src/custom-events/types.ts +3 -3
- package/template/src/language/default-labels/videoCallScreenLabels.ts +4 -2
- package/template/src/pages/Create.tsx +10 -3
- package/template/src/pages/Join.tsx +4 -1
- package/template/src/pages/VideoCall.tsx +61 -56
- package/template/src/pages/video-call/CustomUserContextHolder.tsx +13 -5
- package/template/src/pages/video-call/VideoCallScreen.tsx +18 -15
- package/template/src/rtm/RTMEngine.ts +13 -0
- package/template/src/rtm/utils.ts +1 -1
- package/template/src/rtm-events/EventUtils.ts +3 -0
- package/template/src/rtm-events/EventsQueue.ts +9 -3
- package/template/src/rtm-events/constants.ts +3 -1
- package/template/src/subComponents/ChatBubble.tsx +22 -4
- package/template/src/subComponents/ChatContainer.tsx +30 -19
- package/template/src/subComponents/ChatInput.tsx +38 -26
- package/template/src/subComponents/SelectDevice.tsx +1 -1
- package/template/src/subComponents/recording/useRecording.tsx +15 -4
- package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +11 -5
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +35 -26
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +83 -33
- package/template/src/utils/SdkEvents.ts +3 -3
- package/template/src/utils/getMeetingInvite.ts +38 -15
- package/template/src/utils/getUniqueID.ts +5 -0
- package/template/src/utils/useDeleteMessage.ts +36 -0
- package/template/src/utils/useEditMessage.ts +41 -0
- package/template/src/utils/useGetName.ts +2 -3
- package/template/src/utils/useJoinMeeting.ts +22 -14
- package/template/src/utils/useLocalShareScreenUid.ts +19 -0
- package/template/src/utils/useSendMessage.ts +4 -5
- package/template/src/utils/useSetName.ts +2 -4
- package/template/webpack.rsdk.config.js +3 -2
- package/template/webpack.wsdk.config.js +0 -1
|
@@ -68,14 +68,18 @@ const PreCallLocalMute: React.FC = () => {
|
|
|
68
68
|
<View style={style.width50}>
|
|
69
69
|
<AudioMute />
|
|
70
70
|
</View>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
{!$config.AUDIO_ROOM && (
|
|
72
|
+
<>
|
|
73
|
+
<View style={style.width50} />
|
|
74
|
+
<View style={style.width50}>
|
|
75
|
+
<VideoMute />
|
|
76
|
+
</View>
|
|
77
|
+
<View style={style.width50} />
|
|
78
|
+
<View style={style.width50}>
|
|
79
|
+
<LocalSwitchCamera />
|
|
80
|
+
</View>
|
|
81
|
+
</>
|
|
82
|
+
)}
|
|
79
83
|
</>
|
|
80
84
|
);
|
|
81
85
|
};
|
|
@@ -65,9 +65,11 @@ const PreCallLocalMute: React.FC = () => {
|
|
|
65
65
|
<View style={{alignSelf: 'center'}}>
|
|
66
66
|
<AudioMute />
|
|
67
67
|
</View>
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
68
|
+
{!$config.AUDIO_ROOM && (
|
|
69
|
+
<View style={{alignSelf: 'center'}}>
|
|
70
|
+
<VideoMute />
|
|
71
|
+
</View>
|
|
72
|
+
)}
|
|
71
73
|
</View>
|
|
72
74
|
);
|
|
73
75
|
};
|
|
@@ -30,7 +30,7 @@ const PreCallTextInput: React.FC = () => {
|
|
|
30
30
|
return (
|
|
31
31
|
<TextInput
|
|
32
32
|
value={username}
|
|
33
|
-
onChangeText={(text) => setUsername(text ? text
|
|
33
|
+
onChangeText={(text) => setUsername(text ? text : '')}
|
|
34
34
|
onSubmitEditing={() => {}}
|
|
35
35
|
placeholder={
|
|
36
36
|
isJoinDataFetched ? userNamePlaceholder : fetchingNamePlaceholder
|
|
@@ -25,7 +25,7 @@ import {MeetingInviteInterface} from '../language/default-labels/videoCallScreen
|
|
|
25
25
|
import Clipboard from '../subComponents/Clipboard';
|
|
26
26
|
|
|
27
27
|
export enum SHARE_LINK_CONTENT_TYPE {
|
|
28
|
-
ATTENDEE,
|
|
28
|
+
ATTENDEE = 1,
|
|
29
29
|
HOST,
|
|
30
30
|
PSTN,
|
|
31
31
|
MEETING_INVITE,
|
|
@@ -45,12 +45,8 @@ interface ShareLinkProvideProps {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
48
|
-
const {
|
|
49
|
-
|
|
50
|
-
meetingPassphrase,
|
|
51
|
-
isSeparateHostLink,
|
|
52
|
-
isJoinDataFetched,
|
|
53
|
-
} = useMeetingInfo();
|
|
48
|
+
const {meetingTitle, meetingPassphrase, isSeparateHostLink, isHost} =
|
|
49
|
+
useMeetingInfo();
|
|
54
50
|
|
|
55
51
|
//commmented for v1 release
|
|
56
52
|
// const copiedToClipboardText = useString(
|
|
@@ -65,37 +61,40 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
|
65
61
|
const meetingIdText = 'Meeting ID';
|
|
66
62
|
const PSTNNumberText = 'PSTN Number';
|
|
67
63
|
const PSTNPinText = 'PSTN Pin';
|
|
68
|
-
const meetingInviteText = ({
|
|
64
|
+
const meetingInviteText = ({
|
|
65
|
+
meetingName,
|
|
66
|
+
id,
|
|
67
|
+
url,
|
|
68
|
+
pstn,
|
|
69
|
+
isHost,
|
|
70
|
+
isSeparateHostLink,
|
|
71
|
+
}: MeetingInviteInterface) => {
|
|
69
72
|
let inviteContent = '';
|
|
70
73
|
if (url) {
|
|
71
|
-
//
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
else {
|
|
77
|
-
if (isCallActive) {
|
|
78
|
-
//copy this label on videocall screen
|
|
79
|
-
inviteContent += `Meeting - ${meetingName}\nURL for Attendee: ${url?.attendee}`;
|
|
74
|
+
//for host
|
|
75
|
+
if (isHost) {
|
|
76
|
+
if (isSeparateHostLink) {
|
|
77
|
+
//seperate link for host and attendee
|
|
78
|
+
inviteContent += `Meeting - ${meetingName}\nURL for Attendee: ${url?.attendee}\nURL for Host: ${url?.host}`;
|
|
80
79
|
} else {
|
|
81
|
-
//
|
|
82
|
-
inviteContent += `Meeting - ${meetingName}\nMeeting URL: ${url?.
|
|
80
|
+
//single link for everyone
|
|
81
|
+
inviteContent += `Meeting - ${meetingName}\nMeeting URL: ${url?.host}`;
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
// if host data is present generate meeting ID for both host and attendee
|
|
87
|
-
if (id?.host) {
|
|
88
|
-
inviteContent += `Meeting - ${meetingName}\nAttendee Meeting ID: ${id?.attendee}\nHost Meeting ID: ${id?.host}`;
|
|
89
|
-
}
|
|
90
|
-
// if host data is not present then generate meeting ID for attendee alone
|
|
84
|
+
//for attendee
|
|
91
85
|
else {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
inviteContent += `Meeting - ${meetingName}\nURL for Attendee: ${url?.attendee}`;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
if (isHost) {
|
|
90
|
+
if (isSeparateHostLink) {
|
|
91
|
+
inviteContent += `Meeting - ${meetingName}\nAttendee Meeting ID: ${id?.attendee}\nHost Meeting ID: ${id?.host}`;
|
|
95
92
|
} else {
|
|
96
|
-
|
|
97
|
-
inviteContent += `Meeting - ${meetingName}\nMeeting ID: ${id?.attendee}`;
|
|
93
|
+
inviteContent += `Meeting - ${meetingName}\nMeeting ID: ${id?.host}`;
|
|
98
94
|
}
|
|
95
|
+
} else {
|
|
96
|
+
//copy this label on videocall screen
|
|
97
|
+
inviteContent += `Meeting - ${meetingName}\nAttendee Meeting ID: ${id?.attendee}`;
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
// Adding pstn data into meeting data if present
|
|
@@ -114,15 +113,13 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
|
114
113
|
url: baseURL
|
|
115
114
|
? GetMeetingInviteURL(
|
|
116
115
|
baseURL,
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
isHost,
|
|
117
|
+
meetingPassphrase,
|
|
118
|
+
isSeparateHostLink,
|
|
119
119
|
)
|
|
120
120
|
: undefined,
|
|
121
121
|
id: !baseURL
|
|
122
|
-
? GetMeetingInviteID(
|
|
123
|
-
meetingPassphrase.attendee,
|
|
124
|
-
isSeparateHostLink ? meetingPassphrase.host : undefined,
|
|
125
|
-
)
|
|
122
|
+
? GetMeetingInviteID(isHost, meetingPassphrase, isSeparateHostLink)
|
|
126
123
|
: undefined,
|
|
127
124
|
pstn: meetingPassphrase?.pstn
|
|
128
125
|
? {
|
|
@@ -130,7 +127,8 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
|
130
127
|
pin: meetingPassphrase.pstn.pin,
|
|
131
128
|
}
|
|
132
129
|
: undefined,
|
|
133
|
-
|
|
130
|
+
isHost,
|
|
131
|
+
isSeparateHostLink,
|
|
134
132
|
});
|
|
135
133
|
return stringToCopy;
|
|
136
134
|
};
|
|
@@ -150,7 +148,7 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
|
150
148
|
if (baseURL) {
|
|
151
149
|
stringToCopy += `${baseURL}/${meetingPassphrase.attendee}`;
|
|
152
150
|
} else {
|
|
153
|
-
stringToCopy += `${
|
|
151
|
+
stringToCopy += `${meetingPassphrase.attendee}`;
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
return stringToCopy;
|
|
@@ -163,7 +161,7 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
|
|
|
163
161
|
if (baseURL) {
|
|
164
162
|
stringToCopy += `${baseURL}/${meetingPassphrase.host}`;
|
|
165
163
|
} else {
|
|
166
|
-
stringToCopy += `${
|
|
164
|
+
stringToCopy += `${meetingPassphrase.host}`;
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
return stringToCopy;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
import React, {useState, useContext, useEffect} from 'react';
|
|
13
|
+
import {RenderInterface, useLocalUid} from '../../agora-rn-uikit';
|
|
14
|
+
import {RtcContext} from '../../agora-rn-uikit';
|
|
15
|
+
import {useString} from '../utils/useString';
|
|
16
|
+
import StorageContext from './StorageContext';
|
|
17
|
+
import CustomEvents, {EventLevel} from '../custom-events';
|
|
18
|
+
import {EventNames} from '../rtm-events';
|
|
19
|
+
import useLocalScreenShareUid from '../utils/useLocalShareScreenUid';
|
|
20
|
+
import {createHook} from 'fpe-implementation';
|
|
21
|
+
import ChatContext from './ChatContext';
|
|
22
|
+
|
|
23
|
+
interface UserPreferenceContextInterface {
|
|
24
|
+
displayName: string;
|
|
25
|
+
setDisplayName: React.Dispatch<React.SetStateAction<string>>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const UserPreferenceContext =
|
|
29
|
+
React.createContext<UserPreferenceContextInterface>({
|
|
30
|
+
displayName: '',
|
|
31
|
+
setDisplayName: () => {},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const UserPreferenceProvider = (props: {children: React.ReactNode}) => {
|
|
35
|
+
const localUid = useLocalUid();
|
|
36
|
+
const screenShareUid = useLocalScreenShareUid();
|
|
37
|
+
const {dispatch} = useContext(RtcContext);
|
|
38
|
+
|
|
39
|
+
const {store, setStore} = useContext(StorageContext);
|
|
40
|
+
const {hasUserJoinedRTM} = useContext(ChatContext);
|
|
41
|
+
const getInitialUsername = () =>
|
|
42
|
+
store?.displayName ? store.displayName : '';
|
|
43
|
+
const [displayName, setDisplayName] = useState(getInitialUsername());
|
|
44
|
+
|
|
45
|
+
//commented for v1 release
|
|
46
|
+
// const userText = useString('remoteUserDefaultLabel')();
|
|
47
|
+
const userText = 'User';
|
|
48
|
+
const pstnUserLabel = useString('pstnUserLabel')();
|
|
49
|
+
//commented for v1 release
|
|
50
|
+
//const getScreenShareName = useString('screenshareUserName');
|
|
51
|
+
const getScreenShareName = (name: string) => `${name}'s screenshare`;
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
CustomEvents.on(EventNames.NAME_ATTRIBUTE, (data) => {
|
|
55
|
+
const value = JSON.parse(data?.payload?.value);
|
|
56
|
+
if (value) {
|
|
57
|
+
if (value?.uid) {
|
|
58
|
+
updateRenderListState(value?.uid, {
|
|
59
|
+
name:
|
|
60
|
+
String(value?.uid)[0] === '1'
|
|
61
|
+
? pstnUserLabel
|
|
62
|
+
: value?.name || userText,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (value?.screenShareUid) {
|
|
66
|
+
updateRenderListState(value?.screenShareUid, {
|
|
67
|
+
name: getScreenShareName(value?.name || userText),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
CustomEvents.off(EventNames.NAME_ATTRIBUTE);
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
//Update the store displayName value if the state is changed
|
|
79
|
+
setStore((prevState) => {
|
|
80
|
+
return {
|
|
81
|
+
...prevState,
|
|
82
|
+
displayName,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
//update local state for user and screenshare
|
|
87
|
+
updateRenderListState(localUid, {name: displayName || userText});
|
|
88
|
+
updateRenderListState(screenShareUid, {
|
|
89
|
+
name: getScreenShareName(displayName || userText),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (hasUserJoinedRTM) {
|
|
93
|
+
//update remote state for user and screenshare
|
|
94
|
+
CustomEvents.send(EventNames.NAME_ATTRIBUTE, {
|
|
95
|
+
value: JSON.stringify({
|
|
96
|
+
uid: localUid,
|
|
97
|
+
screenShareUid: screenShareUid,
|
|
98
|
+
name: displayName || userText,
|
|
99
|
+
}),
|
|
100
|
+
level: EventLevel.LEVEL2,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, [displayName, hasUserJoinedRTM]);
|
|
104
|
+
|
|
105
|
+
const updateRenderListState = (
|
|
106
|
+
uid: number,
|
|
107
|
+
data: Partial<RenderInterface>,
|
|
108
|
+
) => {
|
|
109
|
+
dispatch({type: 'UpdateRenderList', value: [uid, data]});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<UserPreferenceContext.Provider
|
|
114
|
+
value={{
|
|
115
|
+
setDisplayName,
|
|
116
|
+
displayName,
|
|
117
|
+
}}>
|
|
118
|
+
{props.children}
|
|
119
|
+
</UserPreferenceContext.Provider>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const useUserPreference = createHook(UserPreferenceContext);
|
|
124
|
+
|
|
125
|
+
export {useUserPreference, UserPreferenceProvider};
|
|
@@ -19,11 +19,9 @@ import {TEventCallback, EventSourceEnum} from './types';
|
|
|
19
19
|
import {adjustUID} from '../rtm/utils';
|
|
20
20
|
|
|
21
21
|
class CustomEvents {
|
|
22
|
-
private engine!: RtmEngine;
|
|
23
22
|
private source: EventSourceEnum = EventSourceEnum.core;
|
|
24
23
|
|
|
25
24
|
constructor(source?: EventSourceEnum) {
|
|
26
|
-
this.engine = RTMEngine.getInstance().engine;
|
|
27
25
|
if (source) {
|
|
28
26
|
this.source = source;
|
|
29
27
|
}
|
|
@@ -37,11 +35,11 @@ class CustomEvents {
|
|
|
37
35
|
* @api private
|
|
38
36
|
*/
|
|
39
37
|
private _persist = async (evt: string, payload: any) => {
|
|
38
|
+
const rtmEngine: RtmEngine = RTMEngine.getInstance().engine;
|
|
40
39
|
try {
|
|
41
|
-
const localUserId = RTMEngine.getInstance().localUid;
|
|
42
40
|
const rtmAttribute = {key: evt, value: JSON.stringify(payload)};
|
|
43
41
|
// Step 1: Call RTM API to update local attributes
|
|
44
|
-
await
|
|
42
|
+
await rtmEngine.addOrUpdateLocalUserAttributes([rtmAttribute]);
|
|
45
43
|
} catch (error) {
|
|
46
44
|
console.log(
|
|
47
45
|
'CUSTOM_EVENT_API error occured while updating the value ',
|
|
@@ -84,7 +82,10 @@ class CustomEvents {
|
|
|
84
82
|
* @param {ToOptions} to uid or uids[] of user
|
|
85
83
|
* @api private
|
|
86
84
|
*/
|
|
87
|
-
private _send = async (rtmPayload: any,
|
|
85
|
+
private _send = async (rtmPayload: any, toUid?: ToOptions) => {
|
|
86
|
+
const to = typeof toUid == 'string' ? parseInt(toUid) : toUid;
|
|
87
|
+
const rtmEngine: RtmEngine = RTMEngine.getInstance().engine;
|
|
88
|
+
|
|
88
89
|
const text = JSON.stringify({
|
|
89
90
|
type: eventMessageType.CUSTOM_EVENT,
|
|
90
91
|
msg: rtmPayload,
|
|
@@ -98,18 +99,18 @@ class CustomEvents {
|
|
|
98
99
|
console.log('CUSTOM_EVENT_API: case 1 executed');
|
|
99
100
|
try {
|
|
100
101
|
const channelId = RTMEngine.getInstance().channelUid;
|
|
101
|
-
await
|
|
102
|
+
await rtmEngine.sendMessageByChannelId(channelId, text);
|
|
102
103
|
} catch (error) {
|
|
103
104
|
console.log('CUSTOM_EVENT_API: send event case 1 error : ', error);
|
|
104
105
|
throw error;
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
// Case 2: send to indivdual
|
|
108
|
-
if (typeof to === 'number' && to
|
|
109
|
+
if (typeof to === 'number' && to !== 0) {
|
|
109
110
|
console.log('CUSTOM_EVENT_API: case 2 executed', to);
|
|
110
111
|
const adjustedUID = adjustUID(to);
|
|
111
112
|
try {
|
|
112
|
-
await
|
|
113
|
+
await rtmEngine.sendMessageToPeer({
|
|
113
114
|
peerId: `${adjustedUID}`,
|
|
114
115
|
offline: false,
|
|
115
116
|
text,
|
|
@@ -126,7 +127,7 @@ class CustomEvents {
|
|
|
126
127
|
try {
|
|
127
128
|
for (const uid of to) {
|
|
128
129
|
const adjustedUID = adjustUID(uid);
|
|
129
|
-
await
|
|
130
|
+
await rtmEngine.sendMessageToPeer({
|
|
130
131
|
peerId: `${adjustedUID}`,
|
|
131
132
|
offline: false,
|
|
132
133
|
text,
|
|
@@ -150,8 +151,12 @@ class CustomEvents {
|
|
|
150
151
|
* @api public
|
|
151
152
|
*/
|
|
152
153
|
on = (evt: string, listener: TEventCallback) => {
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
try {
|
|
155
|
+
if (!this._validateEvt(evt) || !this._validateListener(listener)) return;
|
|
156
|
+
EventUtils.addListener(evt, listener, this.source);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.log('custom-events-on error: ', error);
|
|
159
|
+
}
|
|
155
160
|
};
|
|
156
161
|
|
|
157
162
|
/**
|
|
@@ -165,16 +170,23 @@ class CustomEvents {
|
|
|
165
170
|
* @api public
|
|
166
171
|
*/
|
|
167
172
|
off = (evt?: string, listenerToRemove?: TEventCallback) => {
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
try {
|
|
174
|
+
if (listenerToRemove) {
|
|
175
|
+
if (
|
|
176
|
+
this._validateListener(listenerToRemove) &&
|
|
177
|
+
this._validateEvt(evt)
|
|
178
|
+
) {
|
|
179
|
+
EventUtils.removeListener(evt, listenerToRemove, this.source);
|
|
180
|
+
}
|
|
181
|
+
} else if (evt) {
|
|
182
|
+
if (this._validateEvt(evt)) {
|
|
183
|
+
EventUtils.removeAllListeners(evt, this.source);
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
EventUtils.removeAll(this.source);
|
|
175
187
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.log('custom-events-off error: ', error);
|
|
178
190
|
}
|
|
179
191
|
};
|
|
180
192
|
|
|
@@ -184,7 +196,7 @@ class CustomEvents {
|
|
|
184
196
|
* - If 'to' is empty this method sends channel message.
|
|
185
197
|
*
|
|
186
198
|
*
|
|
187
|
-
* @param {String} evt
|
|
199
|
+
* @param {String} evt Name of the event to register on which listeners are added
|
|
188
200
|
* @param {EventPayload} payload contains action, level, value metrics.
|
|
189
201
|
* - action: {string}
|
|
190
202
|
* - level: 1 | 2 | 3
|
|
@@ -208,12 +220,16 @@ class CustomEvents {
|
|
|
208
220
|
|
|
209
221
|
if (level === 2 || level === 3) {
|
|
210
222
|
console.log('CUSTOM_EVENT_API: Event lifecycle: persist', level);
|
|
211
|
-
|
|
223
|
+
try {
|
|
224
|
+
await this._persist(evt, {...payload, source: this.source});
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.log('custom-events-persist error: ', error);
|
|
227
|
+
}
|
|
212
228
|
}
|
|
213
229
|
try {
|
|
214
230
|
await this._send(rtmPayload, to);
|
|
215
231
|
} catch (error) {
|
|
216
|
-
console.log('CUSTOM_EVENT_API:
|
|
232
|
+
console.log('CUSTOM_EVENT_API: sending failed. ', error);
|
|
217
233
|
}
|
|
218
234
|
};
|
|
219
235
|
}
|
|
@@ -15,12 +15,12 @@ interface IEventPayloadBase {
|
|
|
15
15
|
|
|
16
16
|
interface IEventPayloadWithoutAttributes extends IEventPayloadBase {
|
|
17
17
|
level?: never;
|
|
18
|
-
value:
|
|
18
|
+
value: any;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface IEventPayloadWithAttributes extends IEventPayloadBase {
|
|
22
22
|
level: 2 | 3;
|
|
23
|
-
value:
|
|
23
|
+
value: any;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type EventPayload =
|
|
@@ -40,7 +40,7 @@ export enum EventLevel {
|
|
|
40
40
|
interface dataPayload {
|
|
41
41
|
action: string;
|
|
42
42
|
level: 1 | 2 | 3;
|
|
43
|
-
value:
|
|
43
|
+
value: any;
|
|
44
44
|
}
|
|
45
45
|
interface EvtCbPayload {
|
|
46
46
|
payload: dataPayload;
|
|
@@ -10,6 +10,8 @@ interface NetworkQualityStatusInterface {
|
|
|
10
10
|
}
|
|
11
11
|
export type NetworkQualities = keyof NetworkQualityStatusInterface;
|
|
12
12
|
export interface MeetingInviteInterface {
|
|
13
|
+
isHost: boolean;
|
|
14
|
+
isSeparateHostLink: boolean;
|
|
13
15
|
meetingName?: string;
|
|
14
16
|
pstn?: {
|
|
15
17
|
number: string;
|
|
@@ -17,11 +19,11 @@ export interface MeetingInviteInterface {
|
|
|
17
19
|
};
|
|
18
20
|
url?: {
|
|
19
21
|
host?: string;
|
|
20
|
-
attendee
|
|
22
|
+
attendee?: string;
|
|
21
23
|
};
|
|
22
24
|
id?: {
|
|
23
25
|
host?: string;
|
|
24
|
-
attendee
|
|
26
|
+
attendee?: string;
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
export interface I18nVideoCallScreenLabelsInterface {
|
|
@@ -28,6 +28,9 @@ import useCreateMeeting from '../utils/useCreateMeeting';
|
|
|
28
28
|
import {CreateProvider} from './create/useCreate';
|
|
29
29
|
import useJoinMeeting from '../utils/useJoinMeeting';
|
|
30
30
|
import SDKEvents from '../utils/SdkEvents';
|
|
31
|
+
import {MeetingInfoDefaultValue} from '../components/meeting-info/useMeetingInfo';
|
|
32
|
+
import {useSetMeetingInfo} from '../components/meeting-info/useSetMeetingInfo';
|
|
33
|
+
import useNavigateTo from '../utils/useNavigateTo';
|
|
31
34
|
|
|
32
35
|
const Create = () => {
|
|
33
36
|
const {CreateComponent} = useFpe((data) => {
|
|
@@ -58,9 +61,11 @@ const Create = () => {
|
|
|
58
61
|
const [hostControlCheckbox, setHostControlCheckbox] = useState(true);
|
|
59
62
|
const [roomCreated, setRoomCreated] = useState(false);
|
|
60
63
|
const createRoomFun = useCreateMeeting();
|
|
64
|
+
const {setMeetingInfo} = useSetMeetingInfo();
|
|
61
65
|
const {
|
|
62
66
|
meetingPassphrase: {attendee, host, pstn},
|
|
63
67
|
} = useMeetingInfo();
|
|
68
|
+
const navigateTo = useNavigateTo();
|
|
64
69
|
//commented for v1 release
|
|
65
70
|
// const createdText = useString('meetingCreatedNotificationLabel')();
|
|
66
71
|
// const hostControlsToggle = useString<boolean>('hostControlsToggle');
|
|
@@ -74,7 +79,7 @@ const Create = () => {
|
|
|
74
79
|
toggle
|
|
75
80
|
? 'Restrict Host Controls (Separate host link)'
|
|
76
81
|
: 'Restrict Host Controls (Everyone is a Host)';
|
|
77
|
-
const pstnToggle = () => 'Use PSTN (Join by dialing a number)';
|
|
82
|
+
const pstnToggle = (value: boolean) => 'Use PSTN (Join by dialing a number)';
|
|
78
83
|
const meetingNameInputPlaceholder = useString(
|
|
79
84
|
'meetingNameInputPlaceholder',
|
|
80
85
|
)();
|
|
@@ -88,9 +93,10 @@ const Create = () => {
|
|
|
88
93
|
}
|
|
89
94
|
SDKEvents.on('joinMeetingWithPhrase', (phrase) => {
|
|
90
95
|
console.log(
|
|
91
|
-
'
|
|
96
|
+
'SDKEvents: joinMeetingWithPhrase event called', phrase
|
|
92
97
|
);
|
|
93
|
-
|
|
98
|
+
setMeetingInfo(MeetingInfoDefaultValue);
|
|
99
|
+
navigateTo(phrase)
|
|
94
100
|
});
|
|
95
101
|
return () => {
|
|
96
102
|
SDKEvents.off('joinMeetingWithPhrase');
|
|
@@ -115,6 +121,7 @@ const Create = () => {
|
|
|
115
121
|
if (roomTitle !== '') {
|
|
116
122
|
setLoading(true);
|
|
117
123
|
try {
|
|
124
|
+
setMeetingInfo(MeetingInfoDefaultValue);
|
|
118
125
|
await createRoomFun(roomTitle, enablePSTN, isSeparateHostLink);
|
|
119
126
|
setLoading(false);
|
|
120
127
|
Toast.show({
|
|
@@ -28,6 +28,8 @@ import Error from '../subComponents/Error';
|
|
|
28
28
|
import {useString} from '../utils/useString';
|
|
29
29
|
import useNavigateTo from '../utils/useNavigateTo';
|
|
30
30
|
import {useFpe} from 'fpe-api';
|
|
31
|
+
import {useSetMeetingInfo} from '../components/meeting-info/useSetMeetingInfo';
|
|
32
|
+
import {MeetingInfoDefaultValue} from '../components/meeting-info/useMeetingInfo';
|
|
31
33
|
|
|
32
34
|
const Join = () => {
|
|
33
35
|
//commented for v1 release
|
|
@@ -43,12 +45,13 @@ const Join = () => {
|
|
|
43
45
|
const [error, setError] = useState<null | {name: string; message: string}>(
|
|
44
46
|
null,
|
|
45
47
|
);
|
|
46
|
-
|
|
48
|
+
const {setMeetingInfo} = useSetMeetingInfo();
|
|
47
49
|
const createMeeting = () => {
|
|
48
50
|
history.push('/create');
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
const startCall = async () => {
|
|
54
|
+
setMeetingInfo(MeetingInfoDefaultValue);
|
|
52
55
|
navigateTo(phrase);
|
|
53
56
|
};
|
|
54
57
|
const {JoinComponent} = useFpe((data) => {
|