agora-appbuilder-core 4.0.0-api.7 → 4.0.0-api.9

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 (97) hide show
  1. package/package.json +3 -3
  2. package/template/_package-lock.json +5911 -4861
  3. package/template/agora-rn-uikit/.eslintrc.js +5 -0
  4. package/template/agora-rn-uikit/package.json +14 -14
  5. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +41 -22
  6. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +2 -2
  7. package/template/agora-rn-uikit/src/Rtc/Create.tsx +90 -57
  8. package/template/agora-rn-uikit/src/Rtc/Join.tsx +20 -16
  9. package/template/agora-rn-uikit/src/RtcConfigure.tsx +10 -10
  10. package/template/agora-rn-uikit/src/Utils/isBotUser.ts +15 -0
  11. package/template/agora-rn-uikit/src/Utils/quality.tsx +8 -0
  12. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +32 -16
  13. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +25 -14
  14. package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +15 -9
  15. package/template/agora-rn-uikit/src/index.ts +1 -1
  16. package/template/bridge/rtc/webNg/RtcEngine.ts +73 -58
  17. package/template/bridge/rtc/webNg/{SurfaceView.tsx → RtcSurfaceView.tsx} +20 -26
  18. package/template/bridge/rtc/webNg/Types.ts +20 -5
  19. package/template/bridge/rtc/webNg/index.ts +9 -13
  20. package/template/customization-api/temp.ts +2 -2
  21. package/template/customization-api/typeDefinition.ts +1 -2
  22. package/template/customization-api/utils.ts +1 -2
  23. package/template/index.js +1 -0
  24. package/template/ios/HelloWorld/HelloWorldDebug.entitlements +10 -0
  25. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +4 -0
  26. package/template/ios/Podfile +1 -1
  27. package/template/ios/Podfile.lock +72 -140
  28. package/template/package.json +5 -4
  29. package/template/src/App.tsx +58 -1
  30. package/template/src/AppRoutes.tsx +16 -3
  31. package/template/src/AppWrapper.tsx +21 -19
  32. package/template/src/components/Chat.tsx +17 -8
  33. package/template/src/components/ChatContext.ts +0 -2
  34. package/template/src/components/Controls.tsx +5 -5
  35. package/template/src/components/Controls1.native.tsx +7 -3
  36. package/template/src/components/DeviceConfigure.native.tsx +2 -2
  37. package/template/src/components/DeviceConfigure.tsx +2 -2
  38. package/template/src/components/EventsConfigure.tsx +13 -22
  39. package/template/src/components/GraphQLProvider.tsx +47 -30
  40. package/template/src/components/GridVideo.tsx +6 -2
  41. package/template/src/components/NetworkQualityContext.tsx +11 -5
  42. package/template/src/components/ParticipantsView.tsx +3 -3
  43. package/template/src/components/PinnedVideo.tsx +2 -2
  44. package/template/src/components/Precall.native.tsx +9 -6
  45. package/template/src/components/Precall.tsx +9 -6
  46. package/template/src/components/StorageContext.tsx +5 -2
  47. package/template/src/components/ToastComponent.tsx +7 -1
  48. package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
  49. package/template/src/components/livestream/LiveStreamContext.tsx +42 -33
  50. package/template/src/components/livestream/Types.ts +2 -2
  51. package/template/src/components/participants/Participant.tsx +1 -1
  52. package/template/src/components/participants/UserActionMenuOptions.tsx +7 -2
  53. package/template/src/components/recording-bot/RecordingBotRoute.tsx +42 -0
  54. package/template/src/components/virtual-background/useVB.native.tsx +16 -19
  55. package/template/src/components/virtual-background/useVB.tsx +1 -1
  56. package/template/src/components/whiteboard/WhiteboardConfigure.native.tsx +11 -0
  57. package/template/src/components/whiteboard/WhiteboardConfigure.tsx +5 -0
  58. package/template/src/components/whiteboard/WhiteboardView.native.tsx +91 -12
  59. package/template/src/components/whiteboard/WhiteboardWidget.tsx +15 -4
  60. package/template/src/language/default-labels/precallScreenLabels.ts +5 -3
  61. package/template/src/language/default-labels/videoCallScreenLabels.ts +93 -41
  62. package/template/src/pages/VideoCall.tsx +39 -37
  63. package/template/src/pages/video-call/ActionSheetContent.tsx +4 -3
  64. package/template/src/pages/video-call/NameWithMicIcon.tsx +2 -1
  65. package/template/src/pages/video-call/VideoCallMobileView.tsx +26 -2
  66. package/template/src/pages/video-call/VideoCallScreen.tsx +32 -12
  67. package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +41 -0
  68. package/template/src/pages/video-call/VideoComponent.tsx +5 -2
  69. package/template/src/pages/video-call/VideoRenderer.tsx +55 -34
  70. package/template/src/rtm-events/constants.ts +0 -2
  71. package/template/src/subComponents/ChatBubble.tsx +2 -0
  72. package/template/src/subComponents/LocalAudioMute.tsx +8 -47
  73. package/template/src/subComponents/LocalEndCall.tsx +5 -52
  74. package/template/src/subComponents/LocalSwitchCamera.tsx +3 -3
  75. package/template/src/subComponents/LocalVideoMute.tsx +8 -50
  76. package/template/src/subComponents/SelectDevice.tsx +5 -2
  77. package/template/src/subComponents/SelectDeviceSettings.backup.tsx +9 -6
  78. package/template/src/subComponents/caption/Caption.tsx +12 -10
  79. package/template/src/subComponents/caption/Transcript.tsx +13 -10
  80. package/template/src/subComponents/caption/useTranscriptDownload.native.ts +11 -16
  81. package/template/src/subComponents/caption/utils.ts +1 -0
  82. package/template/src/subComponents/livestream/ApprovedLiveStreamControlsView.tsx +2 -2
  83. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +3 -2
  84. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +1 -1
  85. package/template/src/subComponents/recording/useIsRecordingBot.tsx +38 -0
  86. package/template/src/subComponents/recording/useRecording.tsx +176 -135
  87. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +3 -3
  88. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +1 -22
  89. package/template/src/utils/index.tsx +16 -5
  90. package/template/src/utils/useEndCall.ts +65 -0
  91. package/template/src/utils/useIsLocalUserSpeaking.ts +6 -1
  92. package/template/{bridge/rtc/webNg/LocalView.tsx → src/utils/useLocalAudio.ts} +24 -6
  93. package/template/src/utils/useMuteToggleLocal.ts +10 -5
  94. package/template/src/utils/useSearchParams.tsx +18 -0
  95. package/template/src/wasms/agora-virtual-background.wasm +0 -0
  96. package/template/src/utils/endCallEveryOne.ts +0 -7
  97. package/template/src/utils/useDisableButton.tsx +0 -37
@@ -36,10 +36,14 @@ import NavbarMobile from '../../components/NavbarMobile';
36
36
  import {useVB} from '../../components/virtual-background/useVB';
37
37
  import VBPanel from '../../components/virtual-background/VBPanel';
38
38
  import {WhiteboardListener} from '../../components/Controls';
39
+ import {useWhiteboard} from '../../components/whiteboard/WhiteboardConfigure';
40
+ import WhiteboardView from '../../components/whiteboard/WhiteboardView';
39
41
 
40
42
  const VideoCallMobileView = props => {
41
43
  const {native = true} = props;
44
+ const {customContent} = useContent();
42
45
  const {isScreenShareOnFullView, screenShareData} = useScreenContext();
46
+ const {getWhiteboardUid, isWhiteboardOnFullScreen} = useWhiteboard();
43
47
 
44
48
  const {RtcEngineUnsafe} = useContext(RtcContext);
45
49
  const {dispatch} = useContext(DispatchContext);
@@ -118,17 +122,37 @@ const VideoCallMobileView = props => {
118
122
  return <VBPanel />;
119
123
  }
120
124
 
125
+ if (isWhiteboardOnFullScreen) {
126
+ return (
127
+ <>
128
+ {$config.ENABLE_WHITEBOARD ? <WhiteboardListener /> : <></>}
129
+ <VideoRenderer
130
+ user={{
131
+ uid: customContent[getWhiteboardUid()]?.uid,
132
+ type: 'whiteboard',
133
+ video: 0,
134
+ audio: 0,
135
+ parentUid: undefined,
136
+ name: 'Whiteboard',
137
+ muted: undefined,
138
+ }}
139
+ CustomChild={WhiteboardView}
140
+ />
141
+ </>
142
+ );
143
+ }
144
+
121
145
  return isScreenShareOnFullView &&
122
146
  maxScreenShareUid &&
123
147
  defaultContent[maxScreenShareUid] &&
124
148
  defaultContent[maxScreenShareUid]?.video ? (
125
149
  <>
126
- {!native ? <WhiteboardListener /> : <></>}
150
+ {$config.ENABLE_WHITEBOARD ? <WhiteboardListener /> : <></>}
127
151
  <VideoRenderer user={defaultContent[maxScreenShareUid]} />
128
152
  </>
129
153
  ) : (
130
154
  <>
131
- {!native ? <WhiteboardListener /> : <></>}
155
+ {$config.ENABLE_WHITEBOARD ? <WhiteboardListener /> : <></>}
132
156
  <VideoCallView />
133
157
  </>
134
158
  );
@@ -35,12 +35,12 @@ import events, {PersistanceLevel} from '../../rtm-events-api';
35
35
  import VideoCallMobileView from './VideoCallMobileView';
36
36
  import CaptionContainer from '../../subComponents/caption/CaptionContainer';
37
37
  import Transcript from '../../subComponents/caption/Transcript';
38
-
39
38
  import Spacer from '../../atoms/Spacer';
40
39
  import Leftbar, {LeftbarProps} from '../../components/Leftbar';
41
40
  import Rightbar, {RightbarProps} from '../../components/Rightbar';
42
41
  import useFindActiveSpeaker from '../../utils/useFindActiveSpeaker';
43
42
  import VBPanel from '../../components/virtual-background/VBPanel';
43
+ import {useIsRecordingBot} from '../../subComponents/recording/useIsRecordingBot';
44
44
 
45
45
  const VideoCallScreen = () => {
46
46
  useFindActiveSpeaker();
@@ -231,6 +231,8 @@ const VideoCallScreen = () => {
231
231
  const isDesktop = useIsDesktop();
232
232
  const isSmall = useIsSmall();
233
233
 
234
+ const {isRecordingBot, recordingBotUIConfig} = useIsRecordingBot();
235
+
234
236
  return VideocallComponent ? (
235
237
  <VideocallComponent />
236
238
  ) : // ) : !isDesktop ? (
@@ -255,16 +257,23 @@ const VideoCallScreen = () => {
255
257
  )}
256
258
  </ToolbarProvider>
257
259
  <View style={style.full}>
258
- <ToolbarProvider value={{position: ToolbarPosition.top}}>
259
- {TopbarProps?.length ? (
260
- <TopbarComponent
261
- customItems={TopbarProps}
262
- includeDefaultItems={false}
263
- />
264
- ) : (
265
- <TopbarComponent />
266
- )}
267
- </ToolbarProvider>
260
+ <View
261
+ style={
262
+ isRecordingBot &&
263
+ !recordingBotUIConfig.topBar &&
264
+ style.zeroHeight
265
+ }>
266
+ <ToolbarProvider value={{position: ToolbarPosition.top}}>
267
+ {TopbarProps?.length ? (
268
+ <TopbarComponent
269
+ customItems={TopbarProps}
270
+ includeDefaultItems={false}
271
+ />
272
+ ) : (
273
+ <TopbarComponent />
274
+ )}
275
+ </ToolbarProvider>
276
+ </View>
268
277
  <View
269
278
  style={[
270
279
  style.videoView,
@@ -316,7 +325,14 @@ const VideoCallScreen = () => {
316
325
  <>
317
326
  <CaptionContainer />
318
327
  <Spacer size={10} />
319
- <BottombarComponent />
328
+ <View
329
+ style={
330
+ isRecordingBot &&
331
+ !recordingBotUIConfig.bottomBar &&
332
+ style.zeroHeight
333
+ }>
334
+ <BottombarComponent />
335
+ </View>
320
336
  </>
321
337
  )}
322
338
  </ToolbarProvider>
@@ -362,4 +378,8 @@ const style = StyleSheet.create({
362
378
  flex: 12,
363
379
  flexDirection: 'row',
364
380
  },
381
+ zeroHeight: {
382
+ height: 0,
383
+ visibility: 'hidden',
384
+ },
365
385
  });
@@ -0,0 +1,41 @@
1
+ import React, {useContext, useEffect} from 'react';
2
+ import {PropsContext} from '../../../agora-rn-uikit';
3
+ import VideoCallScreen from '../video-call/VideoCallScreen';
4
+ import {isWebInternal} from '../../utils/common';
5
+ import {useLocation} from '../../components/Router';
6
+ import {getParamFromURL} from '../../utils/common';
7
+ import {useUserPreference} from '../../components/useUserPreference';
8
+ import WhiteboardConfigure from '../../components/whiteboard/WhiteboardConfigure';
9
+
10
+ const VideoCallScreenWithRecordingBot: React.FC = () => {
11
+ const location = useLocation();
12
+ const {setDisplayName} = useUserPreference();
13
+
14
+ const recordingBotName = getParamFromURL(location?.search, 'user_name');
15
+
16
+ useEffect(() => {
17
+ setDisplayName(recordingBotName);
18
+ }, []);
19
+ return <VideoCallScreen />;
20
+ };
21
+
22
+ const VideoCallScreenWrapper: React.FC = () => {
23
+ const {rtcProps} = useContext(PropsContext);
24
+
25
+ if ($config.ENABLE_WHITEBOARD) {
26
+ return (
27
+ <WhiteboardConfigure>
28
+ {rtcProps?.recordingBot ? (
29
+ <VideoCallScreenWithRecordingBot />
30
+ ) : (
31
+ <VideoCallScreen />
32
+ )}
33
+ </WhiteboardConfigure>
34
+ );
35
+ } else if (rtcProps?.recordingBot) {
36
+ return <VideoCallScreenWithRecordingBot />;
37
+ }
38
+ return <VideoCallScreen />;
39
+ };
40
+
41
+ export default VideoCallScreenWrapper;
@@ -2,7 +2,7 @@ import React, {useContext, useEffect, useRef, useState} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import useLayoutsData from './useLayoutsData';
4
4
  import {isArray, useIsDesktop, isValidReactComponent} from '../../utils/common';
5
- import {PropsContext, ClientRole} from '../../../agora-rn-uikit';
5
+ import {PropsContext, ClientRoleType} from '../../../agora-rn-uikit';
6
6
  import {useLayout} from '../../utils/useLayout';
7
7
  import {useContent} from 'customization-api';
8
8
  import {getGridLayoutName} from './DefaultLayouts';
@@ -53,7 +53,10 @@ const VideoComponent = () => {
53
53
  }, [currentLayout]);
54
54
 
55
55
  const showInviteTile = () => {
56
- if ($config.EVENT_MODE && rtcProps.role == ClientRole.Audience) {
56
+ if (
57
+ $config.EVENT_MODE &&
58
+ rtcProps.role == ClientRoleType.ClientRoleAudience
59
+ ) {
57
60
  return false;
58
61
  }
59
62
  if (activeUids.length == 1) return true;
@@ -68,7 +68,12 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
68
68
  const videoMoreMenuRef = useRef(null);
69
69
  const [actionMenuVisible, setActionMenuVisible] = React.useState(false);
70
70
  const {setVideoTileInViewPortState} = useVideoCall();
71
- const {getWhiteboardUid = () => 0} = useWhiteboard();
71
+ const {
72
+ getWhiteboardUid = () => 0,
73
+ isWhiteboardOnFullScreen,
74
+ setWhiteboardOnFullScreen,
75
+ whiteboardActive,
76
+ } = useWhiteboard();
72
77
  const [landscapeMode, setLandscapeMode] = useState(
73
78
  isAndroid() || isIOS() ? true : false,
74
79
  );
@@ -90,22 +95,19 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
90
95
  //if screenshare is on fullscreen then get the width/height to set landscape mode
91
96
  if (isScreenShareOnFullView) {
92
97
  if (isAndroid() || isIOS()) {
93
- const cb = args => {
98
+ const cb = (connection, stats) => {
94
99
  if (
95
- args?.uid == user.uid &&
96
- args?.width &&
97
- args?.height &&
98
- args.height > args.width
100
+ stats?.uid == user.uid &&
101
+ stats?.width &&
102
+ stats?.height &&
103
+ stats.height > stats.width
99
104
  ) {
100
105
  landscapeModeRef.current.landscapeMode && setLandscapeMode(false);
101
106
  }
102
107
  };
103
- const subscription = RtcEngineUnsafe.addListener(
104
- 'RemoteVideoStats',
105
- cb,
106
- );
108
+ RtcEngineUnsafe.addListener('onRemoteVideoStats', cb);
107
109
  setTimeout(() => {
108
- subscription.remove();
110
+ RtcEngineUnsafe.removeAllListeners('onRemoteVideoStats');
109
111
  }, 5000);
110
112
  } else {
111
113
  if (screenShareData && screenShareData?.[user.uid] && isMobileUA()) {
@@ -125,8 +127,13 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
125
127
  }, [screenShareData, isScreenShareOnFullView]);
126
128
 
127
129
  const isNativeScreenShareActive =
128
- (isAndroid() || isIOS()) && isScreenshareActive;
129
- const enableExpandButton = isNativeScreenShareActive ? false : true;
130
+ (isAndroid() || isIOS() || isMobileUA()) && user?.type === 'screenshare';
131
+
132
+ const isNativeWhiteboardActive =
133
+ (isAndroid() || isIOS() || isMobileUA()) && whiteboardActive;
134
+
135
+ const enableExpandButton =
136
+ isNativeScreenShareActive || isNativeWhiteboardActive ? true : false;
130
137
 
131
138
  const {enablePinForMe} = useVideoCall();
132
139
 
@@ -191,13 +198,15 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
191
198
  ) : (
192
199
  <></>
193
200
  )}
194
- {enableExpandButton &&
195
- screenShareData &&
196
- screenShareData?.[user.uid] &&
197
- isMobileUA() ? (
201
+ {(enableExpandButton &&
202
+ screenShareData &&
203
+ screenShareData?.[user.uid] &&
204
+ isMobileUA()) ||
205
+ (isMobileUA() && enableExpandButton && user?.type == 'whiteboard') ? (
198
206
  <IconButton
199
207
  containerStyle={
200
- isScreenShareOnFullView && landscapeMode
208
+ (isScreenShareOnFullView || isWhiteboardOnFullScreen) &&
209
+ landscapeMode
201
210
  ? {
202
211
  position: 'absolute',
203
212
  top: 8,
@@ -206,6 +215,14 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
206
215
  zIndex: 999,
207
216
  elevation: 999,
208
217
  }
218
+ : user?.type == 'whiteboard'
219
+ ? {
220
+ position: 'absolute',
221
+ top: 8,
222
+ left: 8,
223
+ zIndex: 999,
224
+ elevation: 999,
225
+ }
209
226
  : {
210
227
  position: 'absolute',
211
228
  top: 8,
@@ -220,18 +237,22 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
220
237
  }
221
238
  }
222
239
  onPress={() => {
223
- setScreenShareOnFullView(
224
- !screenShareData[user.uid]?.isExpanded,
225
- );
226
- setScreenShareData(prevState => {
227
- return {
228
- ...prevState,
229
- [user.uid]: {
230
- ...prevState[user.uid],
231
- isExpanded: !prevState[user.uid]?.isExpanded,
232
- },
233
- };
234
- });
240
+ if (user?.type == 'whiteboard') {
241
+ setWhiteboardOnFullScreen(!isWhiteboardOnFullScreen);
242
+ } else {
243
+ setScreenShareOnFullView(
244
+ !screenShareData[user.uid]?.isExpanded,
245
+ );
246
+ setScreenShareData(prevState => {
247
+ return {
248
+ ...prevState,
249
+ [user.uid]: {
250
+ ...prevState[user.uid],
251
+ isExpanded: !prevState[user.uid]?.isExpanded,
252
+ },
253
+ };
254
+ });
255
+ }
235
256
  }}
236
257
  iconProps={{
237
258
  iconContainerStyle: {
@@ -241,6 +262,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
241
262
  transform: [{rotate: '-45deg'}],
242
263
  },
243
264
  name:
265
+ isWhiteboardOnFullScreen ||
244
266
  screenShareData?.[user?.uid]?.isExpanded === true
245
267
  ? 'collapse'
246
268
  : 'expand',
@@ -284,7 +306,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
284
306
  avatarSize,
285
307
  );
286
308
  }}
287
- user={isNativeScreenShareActive ? {...user, video: 0} : user}
309
+ user={user}
288
310
  containerStyle={{
289
311
  width:
290
312
  landscapeMode && isScreenShareOnFullView
@@ -292,8 +314,6 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
292
314
  : '100%',
293
315
  height:
294
316
  landscapeMode && isScreenShareOnFullView ? width : '100%',
295
- // width: '100%',
296
- // height: '100%',
297
317
  borderRadius: 4,
298
318
  overflow: 'hidden',
299
319
  }}
@@ -307,6 +327,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
307
327
  </ZoomableWrapper>
308
328
  {(!isScreenShareOnFullView && !CustomChild) ||
309
329
  (CustomChild &&
330
+ !isWhiteboardOnFullScreen &&
310
331
  (pinnedUid !== getWhiteboardUid() || currentLayout === 'grid')) ? (
311
332
  <VideoContainerProvider value={{videoTileWidth}}>
312
333
  <NameWithMicIcon
@@ -325,7 +346,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
325
346
  ) : (
326
347
  <></>
327
348
  )}
328
- {!isScreenShareOnFullView &&
349
+ {!(isScreenShareOnFullView || isWhiteboardOnFullScreen) &&
329
350
  // user.uid !== rtcProps?.screenShareUid &&
330
351
  (isHovered || actionMenuVisible || isMobileUA()) ? (
331
352
  <MoreMenu
@@ -2,7 +2,6 @@
2
2
  // 1. RECORDING
3
3
  const RECORDING_STARTED = 'RECORDING_STARTED';
4
4
  const RECORDING_STOPPED = 'RECORDING_STOPPED';
5
- const RECORDING_STOP_REQUEST = 'RECORDING_STOP_REQUEST';
6
5
  // 2. SCREENSHARE
7
6
  const SCREENSHARE_STARTED = 'SCREENSHARE_STARTED';
8
7
  const SCREENSHARE_STOPPED = 'SCREENSHARE_STOPPED';
@@ -10,7 +9,6 @@ const SCREENSHARE_STOPPED = 'SCREENSHARE_STOPPED';
10
9
  const EventActions = {
11
10
  RECORDING_STARTED,
12
11
  RECORDING_STOPPED,
13
- RECORDING_STOP_REQUEST,
14
12
  SCREENSHARE_STARTED,
15
13
  SCREENSHARE_STOPPED,
16
14
  };
@@ -170,6 +170,7 @@ const style = StyleSheet.create({
170
170
  borderBottomRightRadius: 8,
171
171
  borderTopLeftRadius: 0,
172
172
  borderTopRightRadius: 8,
173
+ maxWidth: '88%',
173
174
  },
174
175
  chatBubbleRemoteViewLayer2: {
175
176
  backgroundColor: 'transparent',
@@ -204,6 +205,7 @@ const style = StyleSheet.create({
204
205
  borderBottomRightRadius: 8,
205
206
  borderTopLeftRadius: 8,
206
207
  borderTopRightRadius: 0,
208
+ maxWidth: '88%',
207
209
  },
208
210
  messageStyle: {
209
211
  fontFamily: ThemeConfig.FontFamily.sansPro,
@@ -14,7 +14,7 @@ import {
14
14
  ToggleState,
15
15
  PermissionState,
16
16
  ImageIcon as UIKitImageIcon,
17
- ClientRole,
17
+ ClientRoleType,
18
18
  PropsContext,
19
19
  useLocalUid,
20
20
  DispatchContext,
@@ -39,9 +39,6 @@ import {
39
39
  toolbarItemMicrophoneText,
40
40
  toolbarItemMicrophoneTooltipText,
41
41
  } from '../language/default-labels/videoCallScreenLabels';
42
- import events from '../rtm-events-api';
43
- import {controlMessageEnum} from '../components/ChatContext';
44
- import {MUTE_REMOTE_TYPE} from '../utils/useRemoteMute';
45
42
 
46
43
  /**
47
44
  * A component to mute / unmute the local audio
@@ -59,55 +56,18 @@ export interface LocalAudioMuteProps {
59
56
  }
60
57
 
61
58
  function LocalAudioMute(props: LocalAudioMuteProps) {
62
- const {dispatch} = useContext(DispatchContext);
63
- const {RtcEngineUnsafe} = useContext(RtcContext);
64
-
65
59
  const {isToolbarMenuItem} = useToolbarMenu();
66
60
  const {rtcProps} = useContext(PropsContext);
67
61
  const {
68
62
  data: {isHost},
69
63
  } = useRoomInfo();
70
64
 
71
- const isHostRef = useRef(isHost);
72
- useEffect(() => {
73
- isHostRef.current = isHost;
74
- }, [isHost]);
75
-
76
65
  const {position} = useToolbar();
77
66
  const local = useLocalUserInfo();
78
67
  const isHandRaised = useIsHandRaised();
79
68
  const localMute = useMuteToggleLocal();
80
69
  const {isOnActionSheet, isOnFirstRow, showLabel} = useActionSheet();
81
70
  const {showToolTip = false, disabled = false, showWarningIcon = true} = props;
82
-
83
- useEffect(() => {
84
- events.on(controlMessageEnum.disableButton, async ({payload}) => {
85
- try {
86
- const data = JSON.parse(payload);
87
- if (
88
- data &&
89
- data?.button === MUTE_REMOTE_TYPE.audio &&
90
- !isHostRef.current
91
- ) {
92
- if (data?.action === true) {
93
- RtcEngineUnsafe.muteLocalAudioStream(true);
94
- dispatch({
95
- type: 'LocalMuteAudio',
96
- value: [0, true],
97
- });
98
- } else {
99
- dispatch({
100
- type: 'LocalMuteAudio',
101
- value: [0, false],
102
- });
103
- }
104
- }
105
- } catch (error) {
106
- console.log('debugging error on disableButton');
107
- }
108
- });
109
- }, []);
110
-
111
71
  const micButtonLabel = useString<I18nDeviceStatus>(toolbarItemMicrophoneText);
112
72
  const micButtonTooltip = useString<I18nDeviceStatus>(
113
73
  toolbarItemMicrophoneTooltipText,
@@ -180,8 +140,9 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
180
140
  // justifyContent: 'center',
181
141
  // alignItems: 'center',
182
142
  // };
183
- const isAudience = rtcProps?.role == ClientRole.Audience;
184
- const isBroadCasting = rtcProps?.role == ClientRole.Broadcaster;
143
+ const isAudience = rtcProps?.role == ClientRoleType.ClientRoleAudience;
144
+ const isBroadCasting =
145
+ rtcProps?.role == ClientRoleType.ClientRoleBroadcaster;
185
146
 
186
147
  iconButtonProps.disabled =
187
148
  permissionDenied || ($config.EVENT_MODE && isAudience && !isBroadCasting)
@@ -218,7 +179,7 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
218
179
  }
219
180
 
220
181
  if (
221
- rtcProps.role == ClientRole.Audience &&
182
+ rtcProps.role == ClientRoleType.ClientRoleAudience &&
222
183
  $config.EVENT_MODE &&
223
184
  !$config.RAISE_HAND
224
185
  ) {
@@ -226,11 +187,11 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
226
187
  }
227
188
 
228
189
  if (
229
- (rtcProps.role == ClientRole.Audience &&
190
+ (rtcProps.role == ClientRoleType.ClientRoleAudience &&
230
191
  $config.EVENT_MODE &&
231
192
  $config.RAISE_HAND &&
232
193
  !isHost) ||
233
- local.localAudioForceDisabled
194
+ local.audioBtnDisabled
234
195
  ) {
235
196
  iconButtonProps.iconProps = {
236
197
  ...iconButtonProps.iconProps,
@@ -238,7 +199,7 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
238
199
  tintColor: $config.SEMANTIC_NEUTRAL,
239
200
  };
240
201
  iconButtonProps.toolTipMessage =
241
- showToolTip && !local.localAudioForceDisabled
202
+ showToolTip && !local.audioBtnDisabled
242
203
  ? lstooltip(isHandRaised(local.uid))
243
204
  : '';
244
205
  iconButtonProps.disabled = true;
@@ -5,19 +5,13 @@ import {Prompt} from '../components/Router';
5
5
  import IconButton, {IconButtonProps} from '../atoms/IconButton';
6
6
  import ReactNativeForegroundService from '@supersami/rn-foreground-service';
7
7
  import {Platform} from 'react-native';
8
- import useSTTAPI from './caption/useSTTAPI';
9
- import {useCaption} from './caption/useCaption';
10
8
  import {useScreenshare} from './screenshare/useScreenshare';
11
- import {DispatchContext, PropsContext} from '../../agora-rn-uikit';
12
9
  import {useToolbarMenu} from '../utils/useMenu';
13
10
  import ToolbarMenuItem from '../atoms/ToolbarMenuItem';
14
11
  import {useActionSheet} from '../utils/useActionSheet';
15
- import RTMEngine from '../rtm/RTMEngine';
16
- import {useAuth} from '../../src/auth/AuthProvider';
17
- import {ENABLE_AUTH} from '../../src/auth/config';
18
- import {useString} from '../../src/utils/useString';
19
- import {toolbarItemLeaveText} from '../../src/language/default-labels/videoCallScreenLabels';
20
- import {useCustomization} from 'customization-implementation';
12
+ import {useString} from '../utils/useString';
13
+ import {toolbarItemLeaveText} from '../language/default-labels/videoCallScreenLabels';
14
+ import useEndCall from '../utils/useEndCall';
21
15
 
22
16
  export interface LocalEndcallProps {
23
17
  render?: (onPress: () => void) => JSX.Element;
@@ -25,7 +19,7 @@ export interface LocalEndcallProps {
25
19
  }
26
20
 
27
21
  /* For android only, bg audio */
28
- const stopForegroundService = () => {
22
+ export const stopForegroundService = () => {
29
23
  if (Platform.OS === 'android') {
30
24
  ReactNativeForegroundService.stop();
31
25
  console.log('stopping foreground service');
@@ -34,56 +28,15 @@ const stopForegroundService = () => {
34
28
 
35
29
  const LocalEndcall = (props: LocalEndcallProps) => {
36
30
  const {isScreenshareActive, stopUserScreenShare} = useScreenshare();
37
- const {
38
- data: {isHost},
39
- } = useRoomInfo();
40
31
  const {isToolbarMenuItem} = useToolbarMenu();
41
- const {dispatch} = useContext(DispatchContext);
42
32
  const {isOnActionSheet, showLabel} = useActionSheet();
43
33
  const endCallLabel = useString(toolbarItemLeaveText)();
44
- const {defaultContent} = useContent();
45
34
  const [endcallVisible, setEndcallVisible] = useState(false);
46
- const {stop} = useSTTAPI();
47
- const {isSTTActive} = useCaption();
48
35
  const onPress = () => {
49
36
  setEndcallVisible(true);
50
37
  };
51
38
  const [endCallState, setEndCallState] = useState(false);
52
- const {rtcProps} = useContext(PropsContext);
53
- const {authLogout, authLogin} = useAuth();
54
-
55
- const beforeEndCall = useCustomization(
56
- data =>
57
- data?.lifecycle?.useBeforeEndCall && data?.lifecycle?.useBeforeEndCall(),
58
- );
59
-
60
- const executeEndCall = async () => {
61
- if (beforeEndCall) {
62
- try {
63
- beforeEndCall(isHost);
64
- } catch (error) {
65
- console.error('ERROR on useBeforeEndCall hook', error);
66
- }
67
- }
68
- setTimeout(() => {
69
- dispatch({
70
- type: 'EndCall',
71
- value: [isHost, false],
72
- });
73
- });
74
- // stopping foreground servie on end call
75
- stopForegroundService();
76
- // stopping STT on call end,if only last user is remaining in call
77
- const usersInCall = Object.entries(defaultContent).filter(
78
- item => item[1].type === 'rtc',
79
- );
80
- usersInCall.length === 1 && isSTTActive && stop();
81
- RTMEngine.getInstance().engine.leaveChannel(rtcProps.channel);
82
- if (!ENABLE_AUTH) {
83
- // await authLogout();
84
- await authLogin();
85
- }
86
- };
39
+ const executeEndCall = useEndCall();
87
40
 
88
41
  useEffect(() => {
89
42
  if (!isScreenshareActive && endCallState) {
@@ -1,7 +1,7 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {Text, ViewStyle} from 'react-native';
3
3
  import {useString} from '../utils/useString';
4
- import {ClientRole, PropsContext, ToggleState} from '../../agora-rn-uikit';
4
+ import {ClientRoleType, PropsContext, ToggleState} from '../../agora-rn-uikit';
5
5
  import Styles from '../components/styles';
6
6
  import {isAndroid, isIOS, useLocalUserInfo, useRtc} from 'customization-api';
7
7
  import IconButton, {IconButtonProps} from '../atoms/IconButton';
@@ -37,8 +37,8 @@ function LocalSwitchCamera(props: LocalSwitchCameraProps) {
37
37
 
38
38
  const {rtcProps} = useContext(PropsContext);
39
39
  const isLiveStream = $config.EVENT_MODE;
40
- const isAudience = rtcProps?.role == ClientRole.Audience;
41
- const isBroadCasting = rtcProps?.role == ClientRole.Broadcaster;
40
+ const isAudience = rtcProps?.role == ClientRoleType.ClientRoleAudience;
41
+ const isBroadCasting = rtcProps?.role == ClientRoleType.ClientRoleBroadcaster;
42
42
  const showTitle = showText ? showLabel : false;
43
43
  const onPress = () => {
44
44
  RtcEngineUnsafe.switchCamera();