agora-appbuilder-core 4.1.10-beta.1 → 4.1.11-beta.2

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.
Files changed (132) hide show
  1. package/package.json +2 -2
  2. package/template/agora-rn-uikit/src/Utils/isBotUser.ts +1 -1
  3. package/template/android/app/build.gradle +0 -7
  4. package/template/bridge/rtc/webNg/RtcEngine.ts +2 -2
  5. package/template/bridge/rtm/web/Types.ts +0 -183
  6. package/template/bridge/rtm/web/index.ts +488 -450
  7. package/template/customization-api/typeDefinition.ts +0 -1
  8. package/template/defaultConfig.js +3 -4
  9. package/template/global.d.ts +0 -1
  10. package/template/ios/Podfile +0 -41
  11. package/template/package.json +5 -5
  12. package/template/src/AppRoutes.tsx +3 -3
  13. package/template/src/ai-agent/components/ControlButtons.tsx +1 -1
  14. package/template/src/assets/font-styles.css +1 -33
  15. package/template/src/assets/fonts/icomoon.ttf +0 -0
  16. package/template/src/assets/selection.json +1 -1
  17. package/template/src/atoms/ActionMenu.tsx +93 -13
  18. package/template/src/atoms/CustomIcon.tsx +1 -8
  19. package/template/src/atoms/DropDownMulti.tsx +80 -29
  20. package/template/src/atoms/Dropdown.tsx +0 -5
  21. package/template/src/atoms/Input.tsx +2 -1
  22. package/template/src/atoms/TertiaryButton.tsx +1 -1
  23. package/template/src/atoms/UserAvatar.tsx +1 -1
  24. package/template/src/components/ChatContext.ts +3 -5
  25. package/template/src/components/Controls.tsx +167 -208
  26. package/template/src/components/DeviceConfigure.tsx +1 -1
  27. package/template/src/components/EventsConfigure.tsx +168 -118
  28. package/template/src/components/Navbar.tsx +11 -14
  29. package/template/src/components/RTMConfigure.tsx +819 -32
  30. package/template/src/components/beauty-effect/useBeautyEffects.tsx +13 -50
  31. package/template/src/components/chat/chatConfigure.tsx +1 -7
  32. package/template/src/components/chat-messages/useChatMessages.tsx +11 -43
  33. package/template/src/components/controls/useControlPermissionMatrix.tsx +4 -32
  34. package/template/src/components/participants/AllHostParticipants.tsx +2 -10
  35. package/template/src/components/participants/Participant.tsx +1 -7
  36. package/template/src/components/participants/UserActionMenuOptions.tsx +2 -12
  37. package/template/src/components/precall/joinCallBtn.native.tsx +7 -2
  38. package/template/src/components/precall/joinCallBtn.tsx +7 -2
  39. package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +16 -15
  40. package/template/src/components/precall/joinWaitingRoomBtn.tsx +31 -17
  41. package/template/src/components/precall/textInput.tsx +45 -22
  42. package/template/src/components/precall/usePreCall.tsx +7 -0
  43. package/template/src/components/recordings/RecordingsDateTable.tsx +2 -3
  44. package/template/src/components/room-info/useRoomInfo.tsx +5 -0
  45. package/template/src/components/useUserPreference.tsx +12 -39
  46. package/template/src/components/virtual-background/useVB.tsx +0 -18
  47. package/template/src/components/whiteboard/WhiteboardConfigure.tsx +0 -27
  48. package/template/src/language/default-labels/videoCallScreenLabels.ts +27 -11
  49. package/template/src/logger/AppBuilderLogger.tsx +3 -11
  50. package/template/src/pages/VideoCall.tsx +518 -171
  51. package/template/src/pages/video-call/ActionSheetContent.tsx +77 -77
  52. package/template/src/pages/video-call/SidePanelHeader.tsx +81 -53
  53. package/template/src/pages/video-call/VideoCallScreen.tsx +0 -18
  54. package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +1 -0
  55. package/template/src/rtm/RTMEngine.ts +37 -262
  56. package/template/src/rtm/utils.ts +1 -68
  57. package/template/src/rtm-events/constants.ts +7 -40
  58. package/template/src/rtm-events-api/Events.ts +39 -158
  59. package/template/src/subComponents/ChatBubble.tsx +3 -3
  60. package/template/src/subComponents/ChatContainer.tsx +9 -19
  61. package/template/src/subComponents/LocalAudioMute.tsx +2 -2
  62. package/template/src/subComponents/LocalVideoMute.tsx +2 -2
  63. package/template/src/subComponents/SidePanelEnum.tsx +0 -1
  64. package/template/src/subComponents/caption/Caption.tsx +48 -7
  65. package/template/src/subComponents/caption/CaptionContainer.tsx +324 -51
  66. package/template/src/subComponents/caption/CaptionIcon.tsx +35 -34
  67. package/template/src/subComponents/caption/CaptionText.tsx +103 -2
  68. package/template/src/subComponents/caption/LanguageSelectorPopup.tsx +179 -69
  69. package/template/src/subComponents/caption/Transcript.tsx +46 -11
  70. package/template/src/subComponents/caption/TranscriptIcon.tsx +27 -35
  71. package/template/src/subComponents/caption/TranscriptText.tsx +78 -3
  72. package/template/src/subComponents/caption/proto/ptoto.js +38 -4
  73. package/template/src/subComponents/caption/proto/test.proto +34 -19
  74. package/template/src/subComponents/caption/useCaption.tsx +754 -11
  75. package/template/src/subComponents/caption/useSTTAPI.tsx +118 -205
  76. package/template/src/subComponents/caption/useStreamMessageUtils.native.ts +152 -33
  77. package/template/src/subComponents/caption/useStreamMessageUtils.ts +165 -34
  78. package/template/src/subComponents/caption/utils.ts +171 -3
  79. package/template/src/subComponents/chat/ChatSendButton.tsx +0 -1
  80. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +0 -16
  81. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +1 -1
  82. package/template/src/subComponents/waiting-rooms/WaitingRoomControls.tsx +4 -7
  83. package/template/src/utils/SdkEvents.ts +3 -0
  84. package/template/src/utils/useEndCall.ts +4 -4
  85. package/template/src/utils/useMuteToggleLocal.ts +10 -14
  86. package/template/src/utils/useSpeechToText.ts +31 -20
  87. package/template/bridge/rtm/web/index-legacy.ts +0 -540
  88. package/template/src/components/RTMConfigure-legacy.tsx +0 -848
  89. package/template/src/components/UserGlobalPreferenceProvider.tsx +0 -227
  90. package/template/src/components/breakout-room/BreakoutRoomPanel.tsx +0 -58
  91. package/template/src/components/breakout-room/context/BreakoutRoomContext.tsx +0 -2508
  92. package/template/src/components/breakout-room/events/BreakoutRoomEventsConfigure.tsx +0 -272
  93. package/template/src/components/breakout-room/events/constants.ts +0 -17
  94. package/template/src/components/breakout-room/hoc/BreakoutRoomNameRenderer.tsx +0 -68
  95. package/template/src/components/breakout-room/hooks/useBreakoutRoomExit.ts +0 -49
  96. package/template/src/components/breakout-room/state/reducer.ts +0 -522
  97. package/template/src/components/breakout-room/state/types.ts +0 -54
  98. package/template/src/components/breakout-room/ui/BreakoutMeetingTitle.tsx +0 -60
  99. package/template/src/components/breakout-room/ui/BreakoutRoomActionMenu.tsx +0 -136
  100. package/template/src/components/breakout-room/ui/BreakoutRoomAnnouncementModal.tsx +0 -135
  101. package/template/src/components/breakout-room/ui/BreakoutRoomGroupSettings.tsx +0 -588
  102. package/template/src/components/breakout-room/ui/BreakoutRoomMainRoomUsers.tsx +0 -142
  103. package/template/src/components/breakout-room/ui/BreakoutRoomMemberActionMenu.tsx +0 -122
  104. package/template/src/components/breakout-room/ui/BreakoutRoomParticipants.tsx +0 -124
  105. package/template/src/components/breakout-room/ui/BreakoutRoomRaiseHand.tsx +0 -65
  106. package/template/src/components/breakout-room/ui/BreakoutRoomRenameModal.tsx +0 -227
  107. package/template/src/components/breakout-room/ui/BreakoutRoomSettings.tsx +0 -140
  108. package/template/src/components/breakout-room/ui/BreakoutRoomTransition.tsx +0 -52
  109. package/template/src/components/breakout-room/ui/BreakoutRoomView.tsx +0 -193
  110. package/template/src/components/breakout-room/ui/ExitBreakoutRoomIconButton.tsx +0 -79
  111. package/template/src/components/breakout-room/ui/ParticipantManualAssignmentModal.tsx +0 -638
  112. package/template/src/components/breakout-room/ui/SelectParticipantAssignmentStrategy.tsx +0 -57
  113. package/template/src/components/common/Dividers.tsx +0 -53
  114. package/template/src/components/controls/toolbar-items/ExitBreakoutRoomToolbarItem.tsx +0 -13
  115. package/template/src/components/raise-hand/RaiseHandButton.tsx +0 -50
  116. package/template/src/components/raise-hand/RaiseHandProvider.tsx +0 -308
  117. package/template/src/components/raise-hand/index.ts +0 -14
  118. package/template/src/components/room-info/useCurrentRoomInfo.tsx +0 -42
  119. package/template/src/components/room-info/useSetBreakoutRoomInfo.tsx +0 -64
  120. package/template/src/pages/video-call/BreakoutVideoCall.tsx +0 -213
  121. package/template/src/pages/video-call/VideoCallContent.tsx +0 -211
  122. package/template/src/pages/video-call/VideoCallStateWrapper.tsx +0 -495
  123. package/template/src/rtm/RTMConfigureBreakoutRoomProvider.tsx +0 -882
  124. package/template/src/rtm/RTMConfigureMainRoomProvider.tsx +0 -757
  125. package/template/src/rtm/RTMCoreProvider.tsx +0 -419
  126. package/template/src/rtm/RTMGlobalStateProvider.tsx +0 -706
  127. package/template/src/rtm/RTMStatusBanner.tsx +0 -99
  128. package/template/src/rtm/constants.ts +0 -12
  129. package/template/src/rtm/hooks/useMainRoomUserDisplayName.ts +0 -45
  130. package/template/src/rtm/rtm-presence-utils.ts +0 -344
  131. package/template/src/subComponents/chat/ChatAnnouncementView.tsx +0 -65
  132. package/template/src/utils/useDebouncedCallback.tsx +0 -20
@@ -1,495 +0,0 @@
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, useRef} from 'react';
13
- import {View, StyleSheet, Text} from 'react-native';
14
- import {useCustomization} from 'customization-implementation';
15
- import {
16
- ClientRoleType,
17
- UidType,
18
- CallbacksInterface,
19
- } from '../../../agora-rn-uikit';
20
- import styles from '../../components/styles';
21
- import {ErrorContext} from '../../components/common/index';
22
- import {useWakeLock} from '../../components/useWakeLock';
23
- import {useParams, useHistory} from '../../components/Router';
24
- import StorageContext from '../../components/StorageContext';
25
- import {useSetRoomInfo} from '../../components/room-info/useSetRoomInfo';
26
- import {SdkApiContext} from '../../components/SdkApiContext';
27
- import {
28
- useRoomInfo,
29
- RoomInfoDefaultValue,
30
- WaitingRoomStatus,
31
- } from '../../components/room-info/useRoomInfo';
32
- import {useIsRecordingBot} from '../../subComponents/recording/useIsRecordingBot';
33
- import Logo from '../../subComponents/Logo';
34
- import SDKEvents from '../../utils/SdkEvents';
35
- import isSDK from '../../utils/isSDK';
36
- import {useHasBrandLogo} from '../../utils/common';
37
- import useJoinRoom from '../../utils/useJoinRoom';
38
- import {useString} from '../../utils/useString';
39
- import {AuthErrorCodes} from '../../utils/common';
40
- import {
41
- userBannedText,
42
- videoRoomStartingCallText,
43
- } from '../../language/default-labels/videoCallScreenLabels';
44
- import {LogSource, logger} from '../../logger/AppBuilderLogger';
45
- import Toast from '../../../react-native-toast-message';
46
- import {RTMCoreProvider} from '../../rtm/RTMCoreProvider';
47
- import {videoView} from '../../../theme.json';
48
- import VideoCallContent from './VideoCallContent';
49
- import RTMGlobalStateProvider from '../../rtm/RTMGlobalStateProvider';
50
- import UserGlobalPreferenceProvider from '../../components/UserGlobalPreferenceProvider';
51
-
52
- export enum RnEncryptionEnum {
53
- /**
54
- * @deprecated
55
- * 0: This mode is deprecated.
56
- */
57
- None = 0,
58
- /**
59
- * 1: (Default) 128-bit AES encryption, XTS mode.
60
- */
61
- AES128XTS = 1,
62
- /**
63
- * 2: 128-bit AES encryption, ECB mode.
64
- */
65
- AES128ECB = 2,
66
- /**
67
- * 3: 256-bit AES encryption, XTS mode.
68
- */
69
- AES256XTS = 3,
70
- /**
71
- * 4: 128-bit SM4 encryption, ECB mode.
72
- *
73
- * @since v3.1.2.
74
- */
75
- SM4128ECB = 4,
76
- /**
77
- * 6: 256-bit AES encryption, GCM mode.
78
- *
79
- * @since v3.1.2.
80
- */
81
- AES256GCM = 6,
82
-
83
- /**
84
- * 7: 128-bit GCM encryption, GCM mode.
85
- *
86
- * @since v3.4.5
87
- */
88
- AES128GCM2 = 7,
89
- /**
90
- * 8: 256-bit GCM encryption, GCM mode.
91
- * @since v3.1.2.
92
- * Compared to AES256GCM encryption mode, AES256GCM2 encryption mode is more secure and requires you to set the salt (encryptionKdfSalt).
93
- */
94
- AES256GCM2 = 8,
95
- }
96
-
97
- const VideoCallStateWrapper = () => {
98
- const hasBrandLogo = useHasBrandLogo();
99
- const joiningLoaderLabel = useString(videoRoomStartingCallText)();
100
- const {isRecordingBot} = useIsRecordingBot();
101
- const {setRoomInfo} = useSetRoomInfo();
102
- const {setGlobalErrorMessage} = useContext(ErrorContext);
103
- const bannedUserText = useString(userBannedText)();
104
-
105
- /**
106
- * Should we set the callscreen to active ??
107
- * a) If Recording bot( i.e prop: recordingBot) is TRUE then it means,
108
- * the recording bot is accessing the screen - so YES we should set
109
- * the callActive as true and we need not check for whether
110
- * $config.PRECALL is enabled or not.
111
- * b) If Recording bot( i.e prop: recordingBot) is FALSE then we should set
112
- * the callActive depending upon the value of magic variable - $config.PRECALL
113
- */
114
- const shouldCallBeSetToActive = isRecordingBot
115
- ? true
116
- : $config.PRECALL
117
- ? false
118
- : true;
119
- const [callActive, setCallActive] = useState(shouldCallBeSetToActive);
120
- const [queryComplete, setQueryComplete] = useState(false);
121
- const [waitingRoomAttendeeJoined, setWaitingRoomAttendeeJoined] =
122
- useState(false);
123
- const {isJoinDataFetched, data, isInWaitingRoom, waitingRoomStatus} =
124
- useRoomInfo();
125
- const {store} = useContext(StorageContext);
126
- const {
127
- join: SdkJoinState,
128
- microphoneDevice: sdkMicrophoneDevice,
129
- cameraDevice: sdkCameraDevice,
130
- clearState,
131
- } = useContext(SdkApiContext);
132
- const useJoin = useJoinRoom();
133
-
134
- const {phrase} = useParams<{phrase: string}>();
135
- const history = useHistory();
136
- const currentMeetingPhrase = useRef(history.location.pathname);
137
- const {awake, release} = useWakeLock();
138
-
139
- const [rtcProps, setRtcProps] = React.useState({
140
- appId: $config.APP_ID,
141
- channel: null,
142
- uid: null,
143
- token: null,
144
- rtm: null,
145
- screenShareUid: null,
146
- screenShareToken: null,
147
- profile: $config.PROFILE,
148
- screenShareProfile: $config.SCREEN_SHARE_PROFILE,
149
- dual: true,
150
- encryption: $config.ENCRYPTION_ENABLED
151
- ? {key: null, mode: RnEncryptionEnum.AES128GCM2, screenKey: null}
152
- : false,
153
- role: ClientRoleType.ClientRoleBroadcaster,
154
- geoFencing: $config.GEO_FENCING,
155
- audioRoom: $config.AUDIO_ROOM,
156
- activeSpeaker: $config.ACTIVE_SPEAKER,
157
- preferredCameraId:
158
- sdkCameraDevice.deviceId || store?.activeDeviceId?.videoinput || null,
159
- preferredMicrophoneId:
160
- sdkMicrophoneDevice.deviceId || store?.activeDeviceId?.audioinput || null,
161
- recordingBot: isRecordingBot ? true : false,
162
- });
163
-
164
- React.useEffect(() => {
165
- if (
166
- //isJoinDataFetched === true && (!queryComplete || !isInWaitingRoom)
167
- //non waiting room - host/attendee
168
- (!$config.ENABLE_WAITING_ROOM &&
169
- isJoinDataFetched === true &&
170
- !queryComplete) ||
171
- //waiting room - host
172
- ($config.ENABLE_WAITING_ROOM &&
173
- isJoinDataFetched === true &&
174
- data.isHost &&
175
- !queryComplete) ||
176
- //waiting room - attendee
177
- ($config.ENABLE_WAITING_ROOM &&
178
- isJoinDataFetched === true &&
179
- !data.isHost &&
180
- (!queryComplete || !isInWaitingRoom) &&
181
- !waitingRoomAttendeeJoined)
182
- ) {
183
- setRtcProps(prevRtcProps => ({
184
- ...prevRtcProps,
185
- channel: data.channel,
186
- uid: data.uid,
187
- token: data.token,
188
- rtm: data.rtmToken,
189
- encryption: $config.ENCRYPTION_ENABLED
190
- ? {
191
- key: data.encryptionSecret,
192
- mode: data.encryptionMode,
193
- screenKey: data.encryptionSecret,
194
- salt: data.encryptionSecretSalt,
195
- }
196
- : false,
197
- screenShareUid: data.screenShareUid,
198
- screenShareToken: data.screenShareToken,
199
- role: data.isHost
200
- ? ClientRoleType.ClientRoleBroadcaster
201
- : ClientRoleType.ClientRoleAudience,
202
- preventJoin:
203
- !$config.ENABLE_WAITING_ROOM ||
204
- ($config.ENABLE_WAITING_ROOM && data.isHost) ||
205
- ($config.ENABLE_WAITING_ROOM &&
206
- !data.isHost &&
207
- waitingRoomStatus === WaitingRoomStatus.APPROVED)
208
- ? false
209
- : true,
210
- }));
211
- if (
212
- $config.ENABLE_WAITING_ROOM &&
213
- !data.isHost &&
214
- waitingRoomStatus === WaitingRoomStatus.APPROVED
215
- ) {
216
- setWaitingRoomAttendeeJoined(true);
217
- }
218
- // 1. Store the display name from API
219
- // if (data.username) {
220
- // setUsername(data.username);
221
- // }
222
- setQueryComplete(true);
223
- }
224
- }, [isJoinDataFetched, data, queryComplete]);
225
-
226
- useEffect(() => {
227
- if (!isJoinDataFetched) {
228
- return;
229
- }
230
- logger.log(LogSource.Internals, 'SET_MEETING_DETAILS', 'Room details', {
231
- user_id: data?.uid || '',
232
- meeting_title: data?.meetingTitle || '',
233
- channel_id: data?.channel,
234
- host_id: data?.roomId?.host || '',
235
- attendee_id: data?.roomId?.attendee || '',
236
- });
237
- }, [isJoinDataFetched, data, phrase]);
238
-
239
- // SDK related code
240
- useEffect(() => {
241
- if (!isSDK() || !SdkJoinState.initialized) {
242
- return;
243
- }
244
- const {
245
- phrase: sdkMeetingPhrase,
246
- meetingDetails: sdkMeetingDetails,
247
- skipPrecall,
248
- promise,
249
- preference,
250
- } = SdkJoinState;
251
-
252
- const sdkMeetingPath = `/${sdkMeetingPhrase}`;
253
-
254
- setCallActive(skipPrecall);
255
-
256
- if (sdkMeetingDetails) {
257
- setQueryComplete(false);
258
- setRoomInfo(roomInfo => {
259
- return {
260
- ...roomInfo,
261
- isJoinDataFetched: true,
262
- data: {
263
- ...roomInfo.data,
264
- ...sdkMeetingDetails,
265
- },
266
- roomPreference: preference,
267
- };
268
- });
269
- } else if (sdkMeetingPhrase) {
270
- setQueryComplete(false);
271
- currentMeetingPhrase.current = sdkMeetingPath;
272
- useJoin(sdkMeetingPhrase, preference)
273
- .then(() => {
274
- logger.log(
275
- LogSource.Internals,
276
- 'JOIN_MEETING',
277
- 'Join channel success',
278
- );
279
- })
280
- .catch(error => {
281
- const errorCode = error?.code;
282
- if (AuthErrorCodes.indexOf(errorCode) !== -1 && isSDK()) {
283
- SDKEvents.emit('unauthorized', error);
284
- }
285
- logger.error(
286
- LogSource.Internals,
287
- 'JOIN_MEETING',
288
- 'Join channel error',
289
- JSON.stringify(error || {}),
290
- );
291
- setGlobalErrorMessage(error);
292
- history.push('/');
293
- currentMeetingPhrase.current = '';
294
- promise.rej(error);
295
- });
296
- }
297
- }, [SdkJoinState]);
298
-
299
- useEffect(() => {
300
- if (!SdkJoinState?.phrase) {
301
- useJoin(phrase, RoomInfoDefaultValue.roomPreference)
302
- .then(() => {
303
- logger.log(
304
- LogSource.Internals,
305
- 'JOIN_MEETING',
306
- 'Join channel success',
307
- );
308
- })
309
- .catch(error => {
310
- const errorCode = error?.code;
311
- if (AuthErrorCodes.indexOf(errorCode) !== -1 && isSDK()) {
312
- SDKEvents.emit('unauthorized', error);
313
- }
314
- logger.error(
315
- LogSource.Internals,
316
- 'JOIN_MEETING',
317
- 'Join channel error',
318
- JSON.stringify(error || {}),
319
- );
320
- setGlobalErrorMessage(error);
321
- history.push('/');
322
- });
323
- }
324
- }, []);
325
-
326
- React.useEffect(() => {
327
- return () => {
328
- logger.debug(
329
- LogSource.Internals,
330
- 'VIDEO_CALL_ROOM',
331
- 'Videocall unmounted',
332
- );
333
- setRoomInfo(prevState => {
334
- return {
335
- ...RoomInfoDefaultValue,
336
- loginToken: prevState?.loginToken,
337
- };
338
- });
339
- if (awake) {
340
- release();
341
- }
342
- };
343
- }, []);
344
-
345
- // commented for v1 release
346
- const afterEndCall = useCustomization(
347
- data =>
348
- data?.lifecycle?.useAfterEndCall && data?.lifecycle?.useAfterEndCall(),
349
- );
350
-
351
- const callbacks: CallbacksInterface = {
352
- // RtcLeft: () => {},
353
- // RtcJoined: () => {
354
- // if (SdkJoinState.phrase && SdkJoinState.skipPrecall) {
355
- // SdkJoinState.promise?.res();
356
- // }
357
- // },
358
- EndCall: () => {
359
- clearState('join');
360
- setTimeout(() => {
361
- // TODO: These callbacks are being called twice
362
- SDKEvents.emit('leave');
363
- if (afterEndCall) {
364
- afterEndCall(data.isHost, history as unknown as History);
365
- } else {
366
- history.push('/');
367
- }
368
- }, 0);
369
- },
370
- // @ts-ignore
371
- UserJoined: (uid: UidType) => {
372
- console.log('UIKIT Callback: UserJoined', uid);
373
- SDKEvents.emit('rtc-user-joined', uid);
374
- },
375
- // @ts-ignore
376
- UserOffline: (uid: UidType) => {
377
- console.log('UIKIT Callback: UserOffline', uid);
378
- SDKEvents.emit('rtc-user-left', uid);
379
- },
380
- // @ts-ignore
381
- RemoteAudioStateChanged: (uid: UidType, status: 0 | 2) => {
382
- console.log('UIKIT Callback: RemoteAudioStateChanged', uid, status);
383
- if (status === 0) {
384
- SDKEvents.emit('rtc-user-unpublished', uid, 'audio');
385
- } else {
386
- SDKEvents.emit('rtc-user-published', uid, 'audio');
387
- }
388
- },
389
- // @ts-ignore
390
- RemoteVideoStateChanged: (uid: UidType, status: 0 | 2) => {
391
- console.log('UIKIT Callback: RemoteVideoStateChanged', uid, status);
392
- if (status === 0) {
393
- SDKEvents.emit('rtc-user-unpublished', uid, 'video');
394
- } else {
395
- SDKEvents.emit('rtc-user-published', uid, 'video');
396
- }
397
- },
398
- // @ts-ignore
399
- UserBanned(isBanned) {
400
- console.log('UIKIT Callback: UserBanned', isBanned);
401
- Toast.show({
402
- leadingIconName: 'alert',
403
- type: 'error',
404
- text1: bannedUserText,
405
- visibilityTime: 3000,
406
- });
407
- },
408
- };
409
-
410
- return (
411
- <>
412
- {queryComplete ? (
413
- queryComplete || !callActive ? (
414
- <RTMCoreProvider
415
- userInfo={{
416
- localUid: rtcProps.uid,
417
- screenShareUid: rtcProps.screenShareUid,
418
- isHost: rtcProps.role === ClientRoleType.ClientRoleBroadcaster,
419
- rtmToken: rtcProps.rtm,
420
- }}>
421
- <RTMGlobalStateProvider
422
- rtmLoginInfo={{
423
- uid: rtcProps.uid,
424
- channel: rtcProps.channel,
425
- }}>
426
- <UserGlobalPreferenceProvider>
427
- <VideoCallContent
428
- callActive={callActive}
429
- setCallActive={setCallActive}
430
- rtcProps={rtcProps}
431
- setRtcProps={setRtcProps}
432
- styleProps={styleProps}
433
- callbacks={callbacks}
434
- />
435
- </UserGlobalPreferenceProvider>
436
- </RTMGlobalStateProvider>
437
- </RTMCoreProvider>
438
- ) : (
439
- <View style={style.loader}>
440
- <View style={style.loaderLogo}>{hasBrandLogo() && <Logo />}</View>
441
- <Text style={style.loaderText}>{joiningLoaderLabel}</Text>
442
- </View>
443
- )
444
- ) : (
445
- <></>
446
- )}
447
- </>
448
- );
449
- };
450
-
451
- const styleProps = {
452
- maxViewStyles: styles.temp,
453
- minViewStyles: styles.temp,
454
- localBtnContainer: styles.bottomBar,
455
- localBtnStyles: {
456
- muteLocalAudio: styles.localButton,
457
- muteLocalVideo: styles.localButton,
458
- switchCamera: styles.localButton,
459
- endCall: styles.endCall,
460
- fullScreen: styles.localButton,
461
- recording: styles.localButton,
462
- screenshare: styles.localButton,
463
- },
464
- theme: $config.PRIMARY_ACTION_BRAND_COLOR,
465
- remoteBtnStyles: {
466
- muteRemoteAudio: styles.remoteButton,
467
- muteRemoteVideo: styles.remoteButton,
468
- remoteSwap: styles.remoteButton,
469
- minCloseBtnStyles: styles.minCloseBtn,
470
- liveStreamHostControlBtns: styles.liveStreamHostControlBtns,
471
- },
472
- BtnStyles: styles.remoteButton,
473
- };
474
- //change these to inline styles or sth
475
- const style = StyleSheet.create({
476
- full: {
477
- flex: 1,
478
- flexDirection: 'column',
479
- overflow: 'hidden',
480
- },
481
- videoView: videoView,
482
- loader: {
483
- flex: 1,
484
- alignSelf: 'center',
485
- justifyContent: 'center',
486
- },
487
- loaderLogo: {
488
- alignSelf: 'center',
489
- justifyContent: 'center',
490
- marginBottom: 30,
491
- },
492
- loaderText: {fontWeight: '500', color: $config.FONT_COLOR},
493
- });
494
-
495
- export default VideoCallStateWrapper;