agora-appbuilder-core 4.0.0-beta.29 → 4.0.0-beta.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-beta.29",
3
+ "version": "4.0.0-beta.31",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -18,9 +18,12 @@ export interface IconsInterface {
18
18
  'turn-off-stt': string;
19
19
  'live-caption-mode': string;
20
20
  done: string;
21
+ warning: string;
21
22
  }
22
23
 
23
24
  const icons: IconsInterface = {
25
+ warning:
26
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM1SURBVHgB7Zo9TBNhGMefUoUiPT+iEXAgDshGtAEXbWKiJCVxAxZd2sWpLrrIYuLA4Ohg4qiTUxlNWNy6oQnRTZ1Y0EGl9IDWD/B9Ds9ctPd+Pu+LXO+XvM2lfZvev89zz9dd5srE8C50ET3QZaSCk04qOOmkgpNOKtgF+b7dYO0Hh8AxlWKTLT84flbPs+WBS5xaeHp8649YBI8vjHwDlzgVHBUbcu/6ulP3diYYXXno2M9/3h9m781d9MEVTgSj0LnJzdjPZye2nFnZiWC0bj4XL8jr34HqVANcYF0wWnd6fFu4D/e4CGDWBT+6+VlqX4atMvME21gVjGmoU6CKo8AsjN+xiTXBKLRTGhJRvdq0GsCsCVa1bggGMJtpyopgXeuGzE7q/VkyWBFcMQw+Xm4nqMBsQC4YXVkmDYnAFGUjTZELNnHlKJimbFiZVDCWjzLXXv1dLlgi9ursTaCErB8ekjy5xy+PQm15IDhGlxUVJuVLPiy9OQJ+OwMUkFk4rhv6Gzz5kJXVXuF+TFOUFRiJYNl6GdGxFHoOVQAjEbww8wVsQllnGwvGNDQ6+ANsgxYunmuBKcaCqdKQCLRydWrDuM42EiwbqKigGAdpCzatl3UxrbO1BVccNOudwDr79rUN0EVL8Ojgd5J6WZfLYy3tNKUleGHmK+gSPVFd18QAputhyoJ1G/uQedYQFEbawTL943Tq7IzKUzwoFGtfl5GZR7PVAzeenFaq3pQsLNsNyUAxtcIAppqmpAXLdkMi1hpZePjiONxfPBEcm1JmqVHFCNKCqdLQnecnYeltP9Tf5+DW01Pgt8zaPvz2vMKgQEow1dgG+Rixqs+uQb9t3r+cVxgHSf0aZUVViJwYlooUMUFlHJQ9e8Z7wNuArlwcawMV6CkoEi1yt9SAXqKZi/f7Zt3Kah93H/fnVBp7FWxVaVhn15bz3DTFdWnX3ZApQZ0tuO0aK9iWdW1TEtx2jRXMu2P/P4POXOLcgYwVTDUW3Q/87fgrNfaT2quBoBLC2HdgFntZW8/C4uu9uXcnhM2D6+eoTECv/PDpMHePMAvKDMsPEunDpUknFZx0UsFJp+sE/wKxVEJyoyLawQAAAABJRU5ErkJggg==',
24
27
  vb: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEfSURBVHgB7VNbEcIwELwwCCgOkIADggMcgAQcVAI4KBJAARLAQeugdXBc6KVzpE2a5Ls7szNtsrebywNgQSoQsSWe+XtLrIlvYsFjJ+xhNQXPD5q5gJD5kfgKmZsFxISMzD26cqq7LHNe7YVYmQ6Mzo5Lc9tdKGDK3IZK1CIkzpzFsmVrUOE0Xjx/k+cyF2DNS1HkQ+vU/A4dIroo2UDzfxsKkOazAcL8LMbunoDKNY/ZosGcCwth8Lf/YmuyHpo1vYg5jf0V1W4NJj40e+c1JAAnHpqaKTCrOhL3xB1xSzRjHbEhfohPpdSD9dpo6P8OER2UgdvjojZ6SGi1wjxcXS/lCUDIQ0fbs5EDK58Q8jC6pmuP8AD9oaaigQWp+AKsAoDF7uWeIAAAAABJRU5ErkJggg==',
25
28
  'vb-image':
26
29
  'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAB20lEQVRIie2UPWsUURSGn2siwcRsdgU/EkjnT5BgsZVgxCaNCiqIIi4WRrD1F6RQxMKAgTRWahkIikktRtzSD1IpCIIEsfAjCQQei5zRyZDdmVjnheHcc+5733fuzLkXdrFTqJ/UEzE+pLbVp+reqF1Rv6rjkTfUl+ozdV8Vg4mIh9W36kK2UG2qi+qZnHhbfaXWona5iskR9V1evANvqiiurlcRf18UV/vVlno3Yr/aow7kxdULZQYfthEfVpfdxK+Iy+pwzF+qJB7k/DcfjPhE/aE2I29G/jjyO5m42igzyMSvqedjvKJOF3jT6kr2+SLW1Td53p6iQUppVW0BD4CPUV4DagVqDViNNb/VOrAAWLaDlrqWtWvU7qsb6g31aMQN9V7MD6mv46mXGfwVjz4/qA6o827FfNR74qAtqUNdxUM0L95WJ3NzY9ExY4U1FzNx9VwVk/3qLePKqAr1bPGgpQ7ElFIyOuo0cAo4BowAfcA68AVoAy+A59EcJ4GRlNKjMoM+4DZwEzgAfAeWgM8xbgCjwPEYf2Oz66ZSSt2vijCYiR85p06ovR14vTE/F/yHRU6nHfwEFoGrpW/zD7PAeEppsIpB98PSBSmlLZrbbh24/r8Gu9gx/gBohhCCgI16xQAAAABJRU5ErkJggg==',
@@ -103,11 +103,10 @@ interface ConfigInterface {
103
103
  ENABLE_IDP_AUTH: boolean;
104
104
  PROJECT_ID: string;
105
105
  ENABLE_STT: boolean;
106
- ENABLE_AINS: boolean;
106
+ ENABLE_NOISE_CANCELLATION: boolean;
107
107
  ENABLE_VIRTUAL_BACKGROUND: boolean;
108
108
  ENABLE_WHITEBOARD: boolean;
109
- ENABLE_CHAT_NOTIFICATION: boolean;
110
- WAITING_ROOM: boolean;
109
+ ENABLE_WAITING_ROOM: boolean;
111
110
  WHITEBOARD_APPIDENTIFIER: string;
112
111
  WHITEBOARD_REGION: string;
113
112
  }
@@ -21,7 +21,7 @@ export function NoiseSupressionProvider(props) {
21
21
  );
22
22
 
23
23
  useEffect(() => {
24
- if ($config.ENABLE_AINS) {
24
+ if ($config.ENABLE_NOISE_CANCELLATION) {
25
25
  }
26
26
  }, []);
27
27
 
@@ -33,7 +33,7 @@ export function NoiseSupressionProvider(props) {
33
33
  let processor = useRef(null);
34
34
 
35
35
  useEffect(() => {
36
- if ($config.ENABLE_AINS) {
36
+ if ($config.ENABLE_NOISE_CANCELLATION) {
37
37
  const denoiserExtension = new AIDenoiserExtension({assetsPath: 'wasm'});
38
38
  AgoraRTC.registerExtensions([denoiserExtension]);
39
39
  processor.current = denoiserExtension.createProcessor();
@@ -42,7 +42,7 @@ export function NoiseSupressionProvider(props) {
42
42
  }, []);
43
43
 
44
44
  const enableNoiseSuppression = async () => {
45
- if (!$config.ENABLE_AINS) {
45
+ if (!$config.ENABLE_NOISE_CANCELLATION) {
46
46
  throw new Error('AINS disabled in config');
47
47
  }
48
48
  //@ts-ignore
@@ -9,7 +9,13 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState, useContext, useEffect, useRef} from 'react';
12
+ import React, {
13
+ useState,
14
+ useContext,
15
+ useEffect,
16
+ useRef,
17
+ useReducer,
18
+ } from 'react';
13
19
  import {View, StyleSheet, useWindowDimensions} from 'react-native';
14
20
  import {
15
21
  DispatchContext,
@@ -72,6 +78,77 @@ import {useVB} from './virtual-background/useVB';
72
78
  import WhiteboardWrapper from './whiteboard/WhiteboardWrapper';
73
79
  import isSDK from '../utils/isSDK';
74
80
 
81
+ const WhiteboardListener = () => {
82
+ const {dispatch} = useContext(DispatchContext);
83
+ const {setCustomContent} = useContent();
84
+ const {currentLayout, setLayout} = useLayout();
85
+
86
+ const {isWhiteBoardOn} = useRoomInfo();
87
+
88
+ //whiteboard start
89
+
90
+ const {
91
+ whiteboardActive,
92
+ joinWhiteboardRoom,
93
+ leaveWhiteboardRoom,
94
+ whiteboardUid,
95
+ } = useContext(whiteboardContext);
96
+
97
+ const WhiteboardStoppedCallBack = () => {
98
+ toggleWhiteboard(true, false);
99
+ };
100
+
101
+ const WhiteboardStartedCallBack = () => {
102
+ toggleWhiteboard(false, false);
103
+ };
104
+
105
+ useEffect(() => {
106
+ whiteboardActive && currentLayout !== 'pinned' && setLayout('pinned');
107
+ }, []);
108
+
109
+ React.useEffect(() => {
110
+ if (isWhiteBoardOn) {
111
+ WhiteboardStartedCallBack();
112
+ } else {
113
+ WhiteboardStoppedCallBack();
114
+ }
115
+ }, [isWhiteBoardOn]);
116
+
117
+ const toggleWhiteboard = (
118
+ whiteboardActive: boolean,
119
+ triggerEvent: boolean,
120
+ ) => {
121
+ if ($config.ENABLE_WHITEBOARD) {
122
+ if (whiteboardActive) {
123
+ leaveWhiteboardRoom();
124
+ setCustomContent(whiteboardUid, false);
125
+ setLayout('grid');
126
+ triggerEvent &&
127
+ events.send(
128
+ 'WhiteBoardStopped',
129
+ JSON.stringify({}),
130
+ PersistanceLevel.Session,
131
+ );
132
+ } else {
133
+ joinWhiteboardRoom();
134
+ setCustomContent(whiteboardUid, WhiteboardWrapper, {}, true);
135
+ dispatch({
136
+ type: 'UserPin',
137
+ value: [whiteboardUid],
138
+ });
139
+ setLayout('pinned');
140
+ triggerEvent &&
141
+ events.send(
142
+ 'WhiteBoardStarted',
143
+ JSON.stringify({}),
144
+ PersistanceLevel.Session,
145
+ );
146
+ }
147
+ }
148
+ };
149
+ return null;
150
+ };
151
+
75
152
  const MoreButton = () => {
76
153
  const {dispatch} = useContext(DispatchContext);
77
154
  const {rtcProps} = useContext(PropsContext);
@@ -116,7 +193,7 @@ const MoreButton = () => {
116
193
  const {isNoiseSupressionEnabled, setNoiseSupression} = useNoiseSupression();
117
194
 
118
195
  //AINS
119
- if ($config.ENABLE_AINS) {
196
+ if ($config.ENABLE_NOISE_CANCELLATION) {
120
197
  actionMenuitems.push({
121
198
  toggleStatus: isNoiseSupressionEnabled === ToggleState.enabled,
122
199
  disabled:
@@ -148,7 +225,7 @@ const MoreButton = () => {
148
225
  }
149
226
  setIsVBActive(prev => !prev);
150
227
  };
151
- if ($config.ENABLE_VIRTUAL_BACKGROUND) {
228
+ if ($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) {
152
229
  actionMenuitems.push({
153
230
  isBase64Icon: true,
154
231
  //@ts-ignore
@@ -185,13 +262,13 @@ const MoreButton = () => {
185
262
  useEffect(() => {
186
263
  whiteboardActive && currentLayout !== 'pinned' && setLayout('pinned');
187
264
 
188
- // if (!$config.WAITING_ROOM) {
265
+ // if (!$config.ENABLE_WAITING_ROOM) {
189
266
  // events.on('WhiteBoardStopped', WhiteboardStoppedCallBack);
190
267
  // events.on('WhiteBoardStarted', WhiteboardStartedCallBack);
191
268
  // }
192
269
 
193
270
  // return () => {
194
- // if (!$config.WAITING_ROOM) {
271
+ // if (!$config.ENABLE_WAITING_ROOM) {
195
272
  // events.off('WhiteBoardStopped', WhiteboardStoppedCallBack);
196
273
  // events.off('WhiteBoardStarted', WhiteboardStartedCallBack);
197
274
  // }
@@ -656,16 +733,26 @@ export const RecordingToolbarItem = () => {
656
733
 
657
734
  export const MoreButtonToolbarItem = () => {
658
735
  const {width} = useWindowDimensions();
659
- return (
660
- (width < BREAKPOINTS.md ||
661
- $config.ENABLE_STT ||
662
- $config.ENABLE_AINS ||
663
- $config.ENABLE_VIRTUAL_BACKGROUND ||
664
- $config.ENABLE_WHITEBOARD) && (
665
- <ToolbarItem testID="more-btn">
666
- <MoreButton />
667
- </ToolbarItem>
668
- )
736
+ const {
737
+ data: {isHost},
738
+ } = useRoomInfo();
739
+ const {isSTTActive} = useCaption();
740
+ const [_, forceUpdate] = useReducer(x => x + 1, 0);
741
+
742
+ useEffect(() => {
743
+ forceUpdate();
744
+ }, [isHost]);
745
+
746
+ return width < BREAKPOINTS.md ||
747
+ ($config.ENABLE_STT && (isHost || (!isHost && isSTTActive))) ||
748
+ $config.ENABLE_NOISE_CANCELLATION ||
749
+ ($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) ||
750
+ (isHost && $config.ENABLE_WHITEBOARD && (isWeb() || isSDK())) ? (
751
+ <ToolbarItem testID="more-btn">
752
+ <MoreButton />
753
+ </ToolbarItem>
754
+ ) : (
755
+ <WhiteboardListener />
669
756
  );
670
757
  };
671
758
  export const LocalEndcallToolbarItem = () => {
@@ -117,7 +117,11 @@ const ParticipantView = props => {
117
117
  */
118
118
  <>
119
119
  {/* c) Waiting Room View */}
120
- {$config.WAITING_ROOM ? <WaitingRoomParticipants /> : <></>}
120
+ {$config.ENABLE_WAITING_ROOM ? (
121
+ <WaitingRoomParticipants />
122
+ ) : (
123
+ <></>
124
+ )}
121
125
  {/* a) Live streaming view */}
122
126
 
123
127
  <CurrentLiveStreamRequestsView userList={liveStreamData} />
@@ -218,7 +222,7 @@ const ParticipantView = props => {
218
222
  </>
219
223
  ) : (
220
224
  <>
221
- {$config.WAITING_ROOM && isHost ? (
225
+ {$config.ENABLE_WAITING_ROOM && isHost ? (
222
226
  <WaitingRoomParticipants />
223
227
  ) : (
224
228
  <></>
@@ -109,7 +109,8 @@ const JoinRoomInputView = ({isDesktop}) => {
109
109
  ? style.btnContainerStyle
110
110
  : {width: '100%'}
111
111
  }>
112
- {$config.WAITING_ROOM && rtcProps.role === ClientRole.Audience ? (
112
+ {$config.ENABLE_WAITING_ROOM &&
113
+ rtcProps.role === ClientRole.Audience ? (
113
114
  <JoinWaitingRoomBtn />
114
115
  ) : (
115
116
  <JoinButton />
@@ -114,7 +114,8 @@ const JoinRoomInputView = ({isDesktop}) => {
114
114
  ? style.btnContainerStyle
115
115
  : {width: '100%'}
116
116
  }>
117
- {$config.WAITING_ROOM && rtcProps.role === ClientRole.Audience ? (
117
+ {$config.ENABLE_WAITING_ROOM &&
118
+ rtcProps.role === ClientRole.Audience ? (
118
119
  <JoinWaitingRoomBtn />
119
120
  ) : (
120
121
  <JoinButton />
@@ -201,7 +202,8 @@ const JoinRoomButton = () => {
201
202
  return components;
202
203
  });
203
204
 
204
- return $config.WAITING_ROOM && rtcProps.role === ClientRole.Audience ? (
205
+ return $config.ENABLE_WAITING_ROOM &&
206
+ rtcProps.role === ClientRole.Audience ? (
205
207
  <JoinWaitingRoomBtn />
206
208
  ) : (
207
209
  <JoinButton />
@@ -503,7 +503,7 @@ const RtmConfigure = (props: any) => {
503
503
 
504
504
  useAsyncEffect(async () => {
505
505
  //waiting room attendee -> rtm login will happen on page load
506
- if ($config.WAITING_ROOM) {
506
+ if ($config.ENABLE_WAITING_ROOM) {
507
507
  //attendee
508
508
  if (!isHost && !callActive) {
509
509
  await init();
@@ -513,7 +513,7 @@ const RtmConfigure = (props: any) => {
513
513
  await init();
514
514
  }
515
515
  }
516
- if (!$config.WAITING_ROOM) {
516
+ if (!$config.ENABLE_WAITING_ROOM) {
517
517
  //host and attendee
518
518
  if (callActive) {
519
519
  await init();
@@ -156,9 +156,6 @@ const ChatMessagesProvider = (props: ChatMessagesProviderProps) => {
156
156
  isPrivateMessage: boolean = false,
157
157
  forceStop: boolean = false,
158
158
  ) => {
159
- if (!$config.ENABLE_CHAT_NOTIFICATION) {
160
- return;
161
- }
162
159
  //don't show group message notification if group chat is open
163
160
  if (!isPrivateMessage && groupActiveRef.current) {
164
161
  return;
@@ -209,7 +206,7 @@ const ChatMessagesProvider = (props: ChatMessagesProviderProps) => {
209
206
  EventNames.PUBLIC_CHAT_MESSAGE,
210
207
  data => {
211
208
  const forceStop =
212
- $config.WAITING_ROOM &&
209
+ $config.ENABLE_WAITING_ROOM &&
213
210
  !isHostRef.current.isHost &&
214
211
  !callActiveRef.current.callActive;
215
212
  const payload = JSON.parse(data.payload);
@@ -187,46 +187,6 @@ export default function UserActionMenuOptionsOptions(
187
187
  },
188
188
  });
189
189
  }
190
-
191
- if ($config.DISABLE_CHAT_OPTION) {
192
- console.log('disable chat uids', disableChatUids);
193
- const isDisableChat = disableChatUids[user.uid]?.disableChat || false;
194
- items.push({
195
- icon: 'chat-outlined',
196
- onHoverIcon: 'chat-filled',
197
- iconColor: $config.SECONDARY_ACTION_COLOR,
198
- textColor: $config.SECONDARY_ACTION_COLOR,
199
- title: `${isDisableChat ? 'Enable' : 'Disable'} Chat`,
200
- callback: () => {
201
- // send l2 custom events
202
- console.warn('sending1 custom events for disable-chat');
203
- // setDisableChat(prev => !prev); // for local user
204
-
205
- setDisableChatUids(prevState => {
206
- // upate disable uids
207
- const isDisabled = prevState[user.uid]
208
- ? prevState[user.uid].disableChat
209
- : false;
210
- return {
211
- ...prevState,
212
- [user.uid]: {
213
- disableChat: !isDisableChat,
214
- },
215
- };
216
- });
217
- setActionMenuVisible(false);
218
- customEvents.send(
219
- 'DisableChat',
220
- JSON.stringify({
221
- disableChatUid: user.uid,
222
- disableChat: !isDisableChat,
223
- }), // uid for chat disabled user
224
- PersistanceLevel.Session,
225
- );
226
- },
227
- });
228
- }
229
-
230
190
  /**
231
191
  * Only host can see this menu item - request/mute - video/audio, promote to co host,demote to audience,remove form meeting
232
192
  */
@@ -135,21 +135,26 @@ const PreCallLocalMute = (props: PreCallProps) => {
135
135
  <PreCallSettings />
136
136
  </>
137
137
  )}
138
- {$config.ENABLE_VIRTUAL_BACKGROUND && !isMobileUA() && (
139
- <>
140
- <Spacer size={isMobileView ? 24 : 16} horizontal={true} />{' '}
141
- <VBButton isVBOpen={isVBOpen} setIsVBOpen={setIsVBOpen} />
142
- </>
143
- )}
144
- {$config.ENABLE_VIRTUAL_BACKGROUND && !isMobileView && !isNative && (
145
- <>
146
- <Spacer size={isMobileView ? 24 : 16} horizontal={true} />{' '}
147
- <SettingsButton
148
- isSettingsOpen={isSettingsOpen}
149
- setIsSettingsOpen={setIsSettingsOpen}
150
- />
151
- </>
152
- )}
138
+ {$config.ENABLE_VIRTUAL_BACKGROUND &&
139
+ !isMobileUA() &&
140
+ !$config.AUDIO_ROOM && (
141
+ <>
142
+ <Spacer size={isMobileView ? 24 : 16} horizontal={true} />{' '}
143
+ <VBButton isVBOpen={isVBOpen} setIsVBOpen={setIsVBOpen} />
144
+ </>
145
+ )}
146
+ {$config.ENABLE_VIRTUAL_BACKGROUND &&
147
+ !$config.AUDIO_ROOM &&
148
+ !isMobileView &&
149
+ !isNative && (
150
+ <>
151
+ <Spacer size={isMobileView ? 24 : 16} horizontal={true} />{' '}
152
+ <SettingsButton
153
+ isSettingsOpen={isSettingsOpen}
154
+ setIsSettingsOpen={setIsSettingsOpen}
155
+ />
156
+ </>
157
+ )}
153
158
  </View>
154
159
  );
155
160
  };
@@ -72,7 +72,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
72
72
  } = useRoomInfo();
73
73
 
74
74
  useEffect(() => {
75
- if ($config.WAITING_ROOM && !isHost && token) {
75
+ if ($config.ENABLE_WAITING_ROOM && !isHost && token) {
76
76
  setCallActive(true);
77
77
  }
78
78
  }, [token]);
@@ -85,7 +85,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
85
85
  } = useRoomInfo();
86
86
 
87
87
  useEffect(() => {
88
- if ($config.WAITING_ROOM && !isHost && token) {
88
+ if ($config.ENABLE_WAITING_ROOM && !isHost && token) {
89
89
  setCallActive(true);
90
90
  }
91
91
  }, [token]);
@@ -36,7 +36,6 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
36
36
  RoomPhase.Disconnected,
37
37
  );
38
38
  const whiteboardUidRef = useRef(Date.now());
39
- console.log('debugging whiteboardUid', whiteboardUidRef.current);
40
39
  const whiteWebSdkClient = useRef({} as WhiteWebSdk);
41
40
  const whiteboardRoom = useRef({} as Room);
42
41
 
@@ -1,4 +1,4 @@
1
- import React, {useState} from 'react';
1
+ import React, {useEffect, useReducer, useState} from 'react';
2
2
  import {
3
3
  View,
4
4
  Text,
@@ -19,6 +19,8 @@ import UserAvatar from '../../atoms/UserAvatar';
19
19
  import ThemeConfig from '../../theme';
20
20
  import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
21
21
  import Spacer from '../../atoms/Spacer';
22
+ import {useLiveStreamDataContext} from '../../components/contexts/LiveStreamDataContext';
23
+ import {useWaitingRoomContext} from '../../components/contexts/WaitingRoomContext';
22
24
 
23
25
  const ChatIcon = () => (
24
26
  <View style={{alignSelf: 'center', marginRight: 20}}>
@@ -36,30 +38,61 @@ const ChatParticipants = (props: any) => {
36
38
  const remoteUserDefaultLabel = 'User';
37
39
  const {selectUser} = props;
38
40
  const {defaultContent, activeUids, customContent} = useContent();
39
- const activeUidsLen = activeUids?.filter((i) => !customContent[i])?.length;
41
+ const activeUidsLen = activeUids?.filter(i => !customContent[i])?.length;
40
42
  const localUid = useLocalUid();
41
43
  const {unreadIndividualMessageCount} = useChatNotification();
42
44
  const isMobile = isMobileUA();
45
+ const {audienceUids, hostUids} = useLiveStreamDataContext();
46
+ const {waitingRoomUids} = useWaitingRoomContext();
47
+ const [_, forceUpdate] = useReducer(x => x + 1, 0);
48
+
49
+ useEffect(() => {
50
+ if ($config.ENABLE_WAITING_ROOM) {
51
+ forceUpdate();
52
+ }
53
+ }, [waitingRoomUids, activeUids]);
54
+
43
55
  return (
44
56
  <ScrollView>
45
- {activeUids && activeUidsLen === 1 ? (
46
- <View style={style.defaultMessageContainer}>
47
- <Text style={style.defaultMessageText}>
48
- No one else has joined yet.
49
- </Text>
50
- </View>
51
- ) : (
52
- <></>
53
- )}
57
+ {
58
+ //video meeting vertical
59
+ (!$config.EVENT_MODE && activeUids && activeUidsLen === 1) ||
60
+ //livestreaming vertical
61
+ ($config.EVENT_MODE && hostUids.length + audienceUids.length === 1) ? (
62
+ <View style={style.defaultMessageContainer}>
63
+ <Text style={style.defaultMessageText}>
64
+ No one else has joined yet.
65
+ </Text>
66
+ </View>
67
+ ) : (
68
+ <></>
69
+ )
70
+ }
54
71
  {Object.keys(defaultContent)
55
- .map((i) => parseInt(i))
56
- .filter((i) => {
72
+ .map(i => parseInt(i))
73
+ .filter(i => {
57
74
  try {
58
75
  if (isNaN(i)) {
59
76
  return false;
60
77
  } else {
61
78
  const userId = i;
62
79
  const userInfo = defaultContent[userId];
80
+ //video meeting with waiting room
81
+ if (
82
+ $config.ENABLE_WAITING_ROOM &&
83
+ !$config.EVENT_MODE &&
84
+ activeUids?.indexOf(userId) === -1
85
+ ) {
86
+ return false;
87
+ }
88
+ //livestreaming with waiting room
89
+ if (
90
+ $config.ENABLE_WAITING_ROOM &&
91
+ $config.EVENT_MODE &&
92
+ hostUids?.concat(audienceUids)?.indexOf(userId) === -1
93
+ ) {
94
+ return false;
95
+ }
63
96
  return (
64
97
  userId !== localUid && //user can't chat with own user
65
98
  // @ts-ignore
@@ -78,7 +111,7 @@ const ChatParticipants = (props: any) => {
78
111
  defaultContent[a]?.lastMessageTimeStamp
79
112
  );
80
113
  })
81
- .map((uid) => {
114
+ .map(uid => {
82
115
  const uidAsNumber = uid;
83
116
  const name = defaultContent[uidAsNumber]
84
117
  ? defaultContent[uidAsNumber].name + ''
@@ -152,7 +152,7 @@ const RecordingProvider = (props: RecordingProviderProps) => {
152
152
  if (prevRecordingState) {
153
153
  if (prevRecordingState?.isRecordingActive === isRecordingActive) return;
154
154
 
155
- if ($config.WAITING_ROOM && !isHost && !callActive) {
155
+ if ($config.ENABLE_WAITING_ROOM && !isHost && !callActive) {
156
156
  return;
157
157
  }
158
158
 
@@ -70,7 +70,7 @@ export default function useJoinRoom() {
70
70
  const {client} = useContext(GraphQLContext);
71
71
  const username = useGetName();
72
72
  const {request: requestToJoin} = useWaitingRoomAPI();
73
- const isWaitingRoomEnabled = $config.WAITING_ROOM;
73
+ const isWaitingRoomEnabled = $config.ENABLE_WAITING_ROOM;
74
74
 
75
75
  return async (phrase: string) => {
76
76
  setRoomInfo(prevState => {