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
@@ -11,14 +11,9 @@
11
11
  */
12
12
 
13
13
  ('use strict');
14
- import {type RTMClient} from 'agora-react-native-rtm';
14
+ import RtmEngine from 'agora-react-native-rtm';
15
15
  import RTMEngine from '../rtm/RTMEngine';
16
- import {
17
- EventUtils,
18
- RTM_EVENT_SCOPE,
19
- RTM_GLOBAL_SCOPE_EVENTS,
20
- RTM_SESSION_SCOPE_EVENTS,
21
- } from '../rtm-events';
16
+ import {EventUtils} from '../rtm-events';
22
17
  import {
23
18
  ReceiverUid,
24
19
  EventCallback,
@@ -28,17 +23,6 @@ import {
28
23
  } from './types';
29
24
  import {adjustUID} from '../rtm/utils';
30
25
  import {LogSource, logger} from '../logger/AppBuilderLogger';
31
- import {nativeChannelTypeMapping} from '../../bridge/rtm/web/Types';
32
-
33
- function getRTMEventScope(eventName: string): RTM_EVENT_SCOPE {
34
- if (RTM_GLOBAL_SCOPE_EVENTS.includes(eventName)) {
35
- return RTM_EVENT_SCOPE.GLOBAL;
36
- }
37
- if (RTM_SESSION_SCOPE_EVENTS.includes(eventName)) {
38
- return RTM_EVENT_SCOPE.SESSION;
39
- }
40
- return RTM_EVENT_SCOPE.LOCAL;
41
- }
42
26
 
43
27
  class Events {
44
28
  private source: EventSource = EventSource.core;
@@ -56,24 +40,12 @@ class Events {
56
40
  * @param {String} payload to be stored in rtm Attribute value
57
41
  * @api private
58
42
  */
59
- private _persist = async (evt: string, payload: string, roomKey?: string) => {
60
- const rtmEngine: RTMClient = RTMEngine.getInstance().engine;
61
- const userId = RTMEngine.getInstance().localUid;
43
+ private _persist = async (evt: string, payload: string) => {
44
+ const rtmEngine: RtmEngine = RTMEngine.getInstance().engine;
62
45
  try {
63
- // const roomAwareKey = roomKey ? `${roomKey}__${evt}` : evt;
64
- // console.log(
65
- // 'session-attributes setting roomAwareKey as: ',
66
- // roomAwareKey,
67
- // evt,
68
- // );
69
46
  const rtmAttribute = {key: evt, value: payload};
70
47
  // Step 1: Call RTM API to update local attributes
71
- await rtmEngine.storage.setUserMetadata(
72
- {items: [rtmAttribute]},
73
- {
74
- userId,
75
- },
76
- );
48
+ await rtmEngine.addOrUpdateLocalUserAttributes([rtmAttribute]);
77
49
  } catch (error) {
78
50
  logger.error(
79
51
  LogSource.Events,
@@ -96,8 +68,8 @@ class Events {
96
68
  `CUSTOM_EVENT_API Event name cannot be of type ${typeof evt}`,
97
69
  );
98
70
  }
99
- if (evt.trim() === '') {
100
- throw Error('CUSTOM_EVENT_API Name or function cannot be empty');
71
+ if (evt.trim() == '') {
72
+ throw Error(`CUSTOM_EVENT_API Name or function cannot be empty`);
101
73
  }
102
74
  return true;
103
75
  };
@@ -125,23 +97,16 @@ class Events {
125
97
  *
126
98
  * @param {Object} rtmPayload payload to be sent across
127
99
  * @param {ReceiverUid} toUid uid or uids[] of user
128
- * @param {string} channelId optional specific channel ID, defaults to primary channel
129
100
  * @api private
130
101
  */
131
102
  private _send = async (
132
103
  rtmPayload: RTMAttributePayload,
133
104
  toUid?: ReceiverUid,
134
- toChannelId?: string,
135
105
  ) => {
136
- const to = typeof toUid === 'string' ? parseInt(toUid, 10) : toUid;
106
+ const to = typeof toUid == 'string' ? parseInt(toUid) : toUid;
107
+ const rtmEngine: RtmEngine = RTMEngine.getInstance().engine;
137
108
 
138
109
  const text = JSON.stringify(rtmPayload);
139
-
140
- if (!RTMEngine.getInstance().isEngineReady) {
141
- throw new Error('RTM Engine is not ready. Call setLocalUID() first.');
142
- }
143
- const rtmEngine: RTMClient = RTMEngine.getInstance().engine;
144
-
145
110
  // Case 1: send to channel
146
111
  if (
147
112
  typeof to === 'undefined' ||
@@ -154,22 +119,8 @@ class Events {
154
119
  'case 1 executed - sending in channel',
155
120
  );
156
121
  try {
157
- logger.debug(
158
- LogSource.Events,
159
- 'CUSTOM_EVENTS',
160
- 'event is sent to targetChannelId ->',
161
- toChannelId,
162
- );
163
- if (!toChannelId || toChannelId.trim() === '') {
164
- throw new Error(
165
- 'Channel ID is not set. Cannot send channel messages.',
166
- );
167
- }
168
- await rtmEngine.publish(toChannelId, text, {
169
- channelType: nativeChannelTypeMapping.MESSAGE, // 1 is message
170
- // customType: 'PlainText',
171
- // messageType: RtmMessageType.string,
172
- });
122
+ const channelId = RTMEngine.getInstance().channelUid;
123
+ await rtmEngine.sendMessageByChannelId(channelId, text);
173
124
  } catch (error) {
174
125
  logger.error(
175
126
  LogSource.Events,
@@ -189,10 +140,10 @@ class Events {
189
140
  );
190
141
  const adjustedUID = adjustUID(to);
191
142
  try {
192
- await rtmEngine.publish(`${adjustedUID}`, text, {
193
- channelType: nativeChannelTypeMapping.USER, // user
194
- customType: 'PlainText',
195
- messageType: 1,
143
+ await rtmEngine.sendMessageToPeer({
144
+ peerId: `${adjustedUID}`,
145
+ offline: false,
146
+ text,
196
147
  });
197
148
  } catch (error) {
198
149
  logger.error(
@@ -213,32 +164,14 @@ class Events {
213
164
  to,
214
165
  );
215
166
  try {
216
- const response = await Promise.allSettled(
217
- to.map(uid =>
218
- rtmEngine.publish(`${adjustUID(uid)}`, text, {
219
- channelType: nativeChannelTypeMapping.USER,
220
- customType: 'PlainText',
221
- messageType: 1,
222
- }),
223
- ),
224
- );
225
- response.forEach((result, index) => {
226
- const uid = to[index];
227
- if (result.status === 'rejected') {
228
- logger.error(
229
- LogSource.Events,
230
- 'CUSTOM_EVENTS',
231
- `Failed to publish to user ${uid}:`,
232
- result.reason,
233
- );
234
- }
235
- });
236
- // for (const uid of to) {
237
- // const adjustedUID = adjustUID(uid);
238
- // await rtmEngine.publish(`${adjustedUID}`, text, {
239
- // channelType: 3, // user
240
- // });
241
- // }
167
+ for (const uid of to) {
168
+ const adjustedUID = adjustUID(uid);
169
+ await rtmEngine.sendMessageToPeer({
170
+ peerId: `${adjustedUID}`,
171
+ offline: false,
172
+ text,
173
+ });
174
+ }
242
175
  } catch (error) {
243
176
  logger.error(
244
177
  LogSource.Events,
@@ -251,10 +184,7 @@ class Events {
251
184
  }
252
185
  };
253
186
 
254
- private _sendAsChannelAttribute = async (
255
- rtmPayload: RTMAttributePayload,
256
- toChannelId?: string,
257
- ) => {
187
+ private _sendAsChannelAttribute = async (rtmPayload: RTMAttributePayload) => {
258
188
  // Case 1: send to channel
259
189
  logger.debug(
260
190
  LogSource.Events,
@@ -262,28 +192,13 @@ class Events {
262
192
  'updating channel attributes',
263
193
  );
264
194
  try {
265
- // Validate if rtmengine is ready
266
- if (!RTMEngine.getInstance().isEngineReady) {
267
- throw new Error('RTM Engine is not ready. Call setLocalUID() first.');
268
- }
269
- const rtmEngine: RTMClient = RTMEngine.getInstance().engine;
270
-
271
- if (!toChannelId) {
272
- throw new Error('Channel ID is not set. Cannot send channel messages.');
273
- }
274
-
195
+ const rtmEngine: RtmEngine = RTMEngine.getInstance().engine;
196
+ const channelId = RTMEngine.getInstance().channelUid;
275
197
  const rtmAttribute = [{key: rtmPayload.evt, value: rtmPayload.value}];
276
- await rtmEngine.storage.setChannelMetadata(
277
- toChannelId,
278
- nativeChannelTypeMapping.MESSAGE,
279
- {
280
- items: rtmAttribute,
281
- },
282
- {
283
- addUserId: true,
284
- addTimeStamp: true,
285
- },
286
- );
198
+ // Step 1: Call RTM API to update local attributes
199
+ await rtmEngine.addOrUpdateChannelAttributes(channelId, rtmAttribute, {
200
+ enableNotificationToChannelMembers: true,
201
+ });
287
202
  } catch (error) {
288
203
  logger.error(
289
204
  LogSource.Events,
@@ -308,8 +223,7 @@ class Events {
308
223
  on = (eventName: string, listener: EventCallback): Function => {
309
224
  try {
310
225
  if (!this._validateEvt(eventName) || !this._validateListener(listener)) {
311
- // Return no-op function instead of undefined to prevent errors
312
- return () => {};
226
+ return;
313
227
  }
314
228
  EventUtils.addListener(eventName, listener, this.source);
315
229
  console.log('CUSTOM_EVENT_API event listener registered', eventName);
@@ -324,8 +238,6 @@ class Events {
324
238
  'Error: events.on',
325
239
  error,
326
240
  );
327
- // Return no-op function on error to prevent undefined issues
328
- return () => {};
329
241
  }
330
242
  };
331
243
 
@@ -341,11 +253,7 @@ class Events {
341
253
  off = (eventName?: string, listener?: EventCallback) => {
342
254
  try {
343
255
  if (listener) {
344
- if (
345
- eventName &&
346
- this._validateListener(listener) &&
347
- this._validateEvt(eventName)
348
- ) {
256
+ if (this._validateListener(listener) && this._validateEvt(eventName)) {
349
257
  // listen off an event by eventName and listener
350
258
  //@ts-ignore
351
259
  EventUtils.removeListener(eventName, listener, this.source);
@@ -379,7 +287,6 @@ class Events {
379
287
  * @param {String} payload (optional) Additional data to be sent along with the event.
380
288
  * @param {Enum} persistLevel (optional) set different levels of persistance. Default value is Level 1
381
289
  * @param {ReceiverUid} receiver (optional) uid or uid array. Default mode sends message in channel.
382
- * @param {String} channelId (optional) specific channel to send to, defaults to primary channel.
383
290
  * @api public
384
291
  * */
385
292
  send = async (
@@ -387,34 +294,17 @@ class Events {
387
294
  payload: string = '',
388
295
  persistLevel: PersistanceLevel = PersistanceLevel.None,
389
296
  receiver: ReceiverUid = -1,
390
- toChannelId?: string,
391
297
  ) => {
392
- try {
393
- if (!this._validateEvt(eventName)) {
394
- return;
395
- }
396
- } catch (error) {
397
- logger.error(
398
- LogSource.Events,
399
- 'CUSTOM_EVENTS',
400
- 'Event validation failed',
401
- error,
402
- );
403
- return; // Don't throw - just log and return
298
+ if (!this._validateEvt(eventName)) {
299
+ return;
404
300
  }
405
301
 
406
- // Add meta data
407
- let currentEventScope = getRTMEventScope(eventName);
408
- let currentChannelId = RTMEngine.getInstance().getActiveChannelId();
409
- let currentRoomKey = RTMEngine.getInstance().getActiveChannelName();
410
-
411
302
  const persistValue = JSON.stringify({
412
303
  payload,
413
304
  persistLevel,
414
305
  source: this.source,
415
- _scope: currentEventScope,
416
- _channelId: currentChannelId,
417
306
  });
307
+
418
308
  const rtmPayload: RTMAttributePayload = {
419
309
  evt: eventName,
420
310
  value: persistValue,
@@ -425,16 +315,9 @@ class Events {
425
315
  persistLevel === PersistanceLevel.Session
426
316
  ) {
427
317
  try {
428
- await this._persist(
429
- eventName,
430
- persistValue,
431
- persistLevel === PersistanceLevel.Session
432
- ? currentRoomKey
433
- : undefined,
434
- );
318
+ await this._persist(eventName, persistValue);
435
319
  } catch (error) {
436
320
  logger.error(LogSource.Events, 'CUSTOM_EVENTS', 'persist error', error);
437
- // don't throw - just log the error, application should continue running
438
321
  }
439
322
  }
440
323
  try {
@@ -444,20 +327,18 @@ class Events {
444
327
  `sending event -> ${eventName}`,
445
328
  persistValue,
446
329
  );
447
- const targetChannelId = toChannelId || currentChannelId;
448
330
  if (persistLevel === PersistanceLevel.Channel) {
449
- await this._sendAsChannelAttribute(rtmPayload, targetChannelId);
331
+ await this._sendAsChannelAttribute(rtmPayload);
450
332
  } else {
451
- await this._send(rtmPayload, receiver, targetChannelId);
333
+ await this._send(rtmPayload, receiver);
452
334
  }
453
335
  } catch (error) {
454
336
  logger.error(
455
337
  LogSource.Events,
456
338
  'CUSTOM_EVENTS',
457
- `Failed to send event '${eventName}' - event lost`,
339
+ 'sending event failed',
458
340
  error,
459
341
  );
460
- // don't throw - just log the error, application should continue running
461
342
  }
462
343
  };
463
344
  }
@@ -52,7 +52,6 @@ import {useChatConfigure} from '../../src/components/chat/chatConfigure';
52
52
  import Tooltip from '../../src/atoms/Tooltip';
53
53
  import {MoreMessageOptions} from './chat/ChatQuickActionsMenu';
54
54
  import {EMessageStatus} from '../../src/ai-agent/components/AgentControls/message';
55
- import {useMainRoomUserDisplayName} from '../rtm/hooks/useMainRoomUserDisplayName';
56
55
 
57
56
  type AttachmentBubbleProps = {
58
57
  fileName: string;
@@ -363,7 +362,6 @@ const ChatBubble = (props: ChatBubbleProps) => {
363
362
  //commented for v1 release
364
363
  //const remoteUserDefaultLabel = useString('remoteUserDefaultLabel')();
365
364
  const remoteUserDefaultLabel = useString(videoRoomUserFallbackText)();
366
- const getDisplayName = useMainRoomUserDisplayName();
367
365
 
368
366
  const getUsername = () => {
369
367
  if (isLocal) {
@@ -372,7 +370,9 @@ const ChatBubble = (props: ChatBubbleProps) => {
372
370
  if (remoteUIConfig?.username) {
373
371
  return trimText(remoteUIConfig?.username);
374
372
  }
375
- return getDisplayName(uid);
373
+ return defaultContent[uid]?.name
374
+ ? trimText(defaultContent[uid].name)
375
+ : remoteUserDefaultLabel;
376
376
  };
377
377
 
378
378
  return props?.render ? (
@@ -27,7 +27,7 @@ import {
27
27
  } from 'react-native';
28
28
  import {RFValue} from 'react-native-responsive-fontsize';
29
29
  import ChatBubble from './ChatBubble';
30
- import ChatContext, {ChatBubbleProps} from '../components/ChatContext';
30
+ import {ChatBubbleProps} from '../components/ChatContext';
31
31
  import {
32
32
  DispatchContext,
33
33
  ContentInterface,
@@ -59,7 +59,6 @@ import {
59
59
  } from '../language/default-labels/videoCallScreenLabels';
60
60
  import CommonStyles from '../components/CommonStyles';
61
61
  import PinnedMessage from './chat/PinnedMessage';
62
- import ChatAnnouncementView from './chat/ChatAnnouncementView';
63
62
 
64
63
  /**
65
64
  * Chat container is the component which renders all the chat messages
@@ -72,7 +71,6 @@ const ChatContainer = (props?: {
72
71
  const info1 = useString<boolean>(groupChatWelcomeContent);
73
72
  const [scrollToEnd, setScrollToEnd] = useState(false);
74
73
  const {dispatch} = useContext(DispatchContext);
75
- const {syncUserState} = useContext(ChatContext);
76
74
  const [grpUnreadCount, setGrpUnreadCount] = useState(0);
77
75
  const [privateUnreadCount, setPrivateUnreadCount] = useState(0);
78
76
  const {defaultContent} = useContent();
@@ -120,18 +118,16 @@ const ChatContainer = (props?: {
120
118
  });
121
119
  //Once message is seen, reset lastMessageTimeStamp.
122
120
  //so whoever has unread count will show in the top of participant list
123
- // updateRenderListState(privateChatUser, {lastMessageTimeStamp: 0});
124
- syncUserState(privateChatUser, {lastMessageTimeStamp: 0});
121
+ updateRenderListState(privateChatUser, {lastMessageTimeStamp: 0});
125
122
  }
126
123
  }, [privateChatUser]);
127
124
 
128
- // We will be using syncRoomusers
129
- // const updateRenderListState = (
130
- // uid: number,
131
- // data: Partial<ContentInterface>,
132
- // ) => {
133
- // dispatch({type: 'UpdateRenderList', value: [uid, data]});
134
- // };
125
+ const updateRenderListState = (
126
+ uid: number,
127
+ data: Partial<ContentInterface>,
128
+ ) => {
129
+ dispatch({type: 'UpdateRenderList', value: [uid, data]});
130
+ };
135
131
 
136
132
  const onScroll = event => {
137
133
  setScrollOffset(event.nativeEvent.contentOffset.y);
@@ -253,13 +249,7 @@ const ChatContainer = (props?: {
253
249
  </Text>
254
250
  </View>
255
251
  ) : null}
256
-
257
- {message?.announcement ? (
258
- <ChatAnnouncementView
259
- message={message.msg}
260
- announcement={message.announcement}
261
- />
262
- ) : !message?.hide ? (
252
+ {!message?.hide ? (
263
253
  <ChatBubbleComponent
264
254
  isLocal={localUid === message.uid}
265
255
  isSameUser={
@@ -85,7 +85,7 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
85
85
  local.permissionStatus === PermissionState.REJECTED ||
86
86
  local.permissionStatus === PermissionState.GRANTED_FOR_CAM_ONLY;
87
87
 
88
- const onPress = async () => {
88
+ const onPress = () => {
89
89
  logger.log(
90
90
  LogSource.Internals,
91
91
  'LOCAL_MUTE',
@@ -95,7 +95,7 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
95
95
  permissionDenied,
96
96
  },
97
97
  );
98
- await localMute(MUTE_LOCAL_TYPE.audio);
98
+ localMute(MUTE_LOCAL_TYPE.audio);
99
99
  };
100
100
  const audioLabel = permissionDenied
101
101
  ? micButtonLabel(I18nDeviceStatus.PERMISSION_DENIED)
@@ -79,7 +79,7 @@ function LocalVideoMute(props: LocalVideoMuteProps) {
79
79
  );
80
80
 
81
81
  const lstooltip = useString<boolean>(livestreamingCameraTooltipText);
82
- const onPress = async () => {
82
+ const onPress = () => {
83
83
  //if screensharing is going on native - to turn on video screenshare should be turn off
84
84
  //show confirm popup to stop the screenshare
85
85
  logger.log(
@@ -91,7 +91,7 @@ function LocalVideoMute(props: LocalVideoMuteProps) {
91
91
  permissionDenied,
92
92
  },
93
93
  );
94
- await localMute(MUTE_LOCAL_TYPE.video);
94
+ localMute(MUTE_LOCAL_TYPE.video);
95
95
  };
96
96
  const isVideoEnabled = local.video === ToggleState.enabled;
97
97
 
@@ -16,5 +16,4 @@ export enum SidePanelType {
16
16
  Settings = 'Settings',
17
17
  Transcript = 'Transcript',
18
18
  VirtualBackground = 'VirtualBackground',
19
- BreakoutRoom = 'BreakoutRoom',
20
19
  }
@@ -8,7 +8,11 @@ import {isWebInternal} from '../../utils/common';
8
8
  import useStreamMessageUtils from './useStreamMessageUtils';
9
9
  import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
10
10
  import {useString} from '../../utils/useString';
11
- import {sttSettingSpokenLanguageText} from '../../language/default-labels/videoCallScreenLabels';
11
+ import {useLocalUid} from '../../../agora-rn-uikit';
12
+ import {
13
+ sttSettingSpokenLanguageText,
14
+ sttSettingTranslationLanguageText,
15
+ } from '../../language/default-labels/videoCallScreenLabels';
12
16
 
13
17
  export type WebStreamMessageArgs = [number, Uint8Array];
14
18
  export type NativeStreamMessageArgs = [
@@ -33,13 +37,22 @@ const Caption: React.FC<CaptionProps> = ({
33
37
  const {RtcEngineUnsafe} = useRtc();
34
38
  const {
35
39
  isLangChangeInProgress,
40
+ isTranslationChangeInProgress,
36
41
  captionObj, //state for current live caption for all users
37
42
  isSTTListenerAdded,
38
43
  setIsSTTListenerAdded,
39
44
  activeSpeakerRef,
40
45
  prevSpeakerRef,
46
+ getBotOwnerUid,
47
+ isSTTActive,
48
+ translationConfig,
49
+ remoteSpokenLanguages,
41
50
  } = useCaption();
51
+ const currentUserUid = useLocalUid();
42
52
  const ssLabel = useString(sttSettingSpokenLanguageText)();
53
+ const stLabel = useString<boolean>(sttSettingTranslationLanguageText)(
54
+ isSTTActive,
55
+ );
43
56
  const {streamMessageCallback} = useStreamMessageUtils();
44
57
  const {defaultContent} = useContent();
45
58
 
@@ -66,18 +79,20 @@ const Caption: React.FC<CaptionProps> = ({
66
79
  // eslint-disable-next-line react-hooks/exhaustive-deps
67
80
  }, []);
68
81
 
69
- if (isLangChangeInProgress)
82
+ if (isLangChangeInProgress || isTranslationChangeInProgress) {
70
83
  return (
71
84
  <Loading
72
- text={ssLabel}
85
+ text={stLabel}
73
86
  background="transparent"
74
87
  indicatorColor={$config.FONT_COLOR + hexadecimalTransparency['70%']}
75
88
  textColor={$config.FONT_COLOR + hexadecimalTransparency['70%']}
76
89
  />
77
90
  );
91
+ }
78
92
 
79
- console.log('current speaker uid', activeSpeakerRef.current);
80
- console.log('prev current uid ', prevSpeakerRef.current);
93
+ console.log('[STT_PER_USER_BOT] speaker uid', activeSpeakerRef.current);
94
+ console.log('[STT_PER_USER_BOT] prev current uid ', prevSpeakerRef.current);
95
+ console.log('[STT_PER_USER_BOT] captionObj ', captionObj);
81
96
 
82
97
  const speakerCount = prevSpeakerRef.current === '' ? 1 : 2;
83
98
 
@@ -104,8 +119,12 @@ const Caption: React.FC<CaptionProps> = ({
104
119
  {captionObj[prevSpeakerRef.current] &&
105
120
  captionObj[prevSpeakerRef.current].text ? (
106
121
  <CaptionText
107
- user={defaultContent[prevSpeakerRef.current].name || 'Speaker'}
122
+ user={
123
+ defaultContent[getBotOwnerUid(prevSpeakerRef.current)]?.name ||
124
+ 'Speaker'
125
+ }
108
126
  value={captionObj[prevSpeakerRef.current].text}
127
+ translations={captionObj[prevSpeakerRef.current].translations}
109
128
  activeSpeakersCount={speakerCount}
110
129
  isActiveSpeaker={false}
111
130
  activelinesAvailable={activelinesAvailable}
@@ -114,6 +133,15 @@ const Caption: React.FC<CaptionProps> = ({
114
133
  setInActiveLinesAvaialble={setInActiveLinesAvaialble}
115
134
  captionUserStyle={captionUserStyle}
116
135
  captionTextStyle={captionTextStyle}
136
+ speakerUid={getBotOwnerUid(prevSpeakerRef.current)}
137
+ userLocalUid={currentUserUid}
138
+ spokenLanguageCode={
139
+ getBotOwnerUid(prevSpeakerRef.current) === currentUserUid
140
+ ? translationConfig.source[0]
141
+ : remoteSpokenLanguages[
142
+ getBotOwnerUid(prevSpeakerRef.current)
143
+ ]
144
+ }
117
145
  />
118
146
  ) : (
119
147
  <></>
@@ -121,8 +149,12 @@ const Caption: React.FC<CaptionProps> = ({
121
149
  {captionObj[activeSpeakerRef.current] &&
122
150
  captionObj[activeSpeakerRef.current].text ? (
123
151
  <CaptionText
124
- user={defaultContent[activeSpeakerRef.current].name || 'Speaker'}
152
+ user={
153
+ defaultContent[getBotOwnerUid(activeSpeakerRef.current)]
154
+ ?.name || 'Speaker'
155
+ }
125
156
  value={captionObj[activeSpeakerRef.current].text}
157
+ translations={captionObj[activeSpeakerRef.current].translations}
126
158
  activeSpeakersCount={speakerCount}
127
159
  isActiveSpeaker={true}
128
160
  activelinesAvailable={activelinesAvailable}
@@ -131,6 +163,15 @@ const Caption: React.FC<CaptionProps> = ({
131
163
  setInActiveLinesAvaialble={setInActiveLinesAvaialble}
132
164
  captionUserStyle={captionUserStyle}
133
165
  captionTextStyle={captionTextStyle}
166
+ speakerUid={getBotOwnerUid(activeSpeakerRef.current)}
167
+ userLocalUid={currentUserUid}
168
+ spokenLanguageCode={
169
+ getBotOwnerUid(activeSpeakerRef.current) === currentUserUid
170
+ ? translationConfig.source[0]
171
+ : remoteSpokenLanguages[
172
+ getBotOwnerUid(activeSpeakerRef.current)
173
+ ]
174
+ }
134
175
  />
135
176
  ) : (
136
177
  <></>