agora-appbuilder-core 4.1.9 → 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 (58) hide show
  1. package/package.json +2 -2
  2. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +1 -3
  3. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +1 -2
  4. package/template/agora-rn-uikit/src/Reducer/index.ts +0 -2
  5. package/template/agora-rn-uikit/src/Rtc/Join.tsx +11 -25
  6. package/template/agora-rn-uikit/src/RtcConfigure.tsx +1 -14
  7. package/template/agora-rn-uikit/src/Utils/isBotUser.ts +1 -1
  8. package/template/android/app/build.gradle +0 -7
  9. package/template/bridge/rtm/web/Types.ts +0 -183
  10. package/template/bridge/rtm/web/index.ts +491 -423
  11. package/template/defaultConfig.js +3 -3
  12. package/template/ios/Podfile +0 -41
  13. package/template/package.json +5 -5
  14. package/template/src/assets/font-styles.css +4 -0
  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 -0
  19. package/template/src/atoms/DropDownMulti.tsx +80 -29
  20. package/template/src/atoms/Input.tsx +2 -1
  21. package/template/src/components/Controls.tsx +148 -143
  22. package/template/src/components/EventsConfigure.tsx +152 -97
  23. package/template/src/components/RTMConfigure.tsx +426 -644
  24. package/template/src/components/precall/joinCallBtn.native.tsx +7 -2
  25. package/template/src/components/precall/joinCallBtn.tsx +7 -2
  26. package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +8 -3
  27. package/template/src/components/precall/joinWaitingRoomBtn.tsx +22 -4
  28. package/template/src/components/precall/textInput.tsx +45 -22
  29. package/template/src/components/precall/usePreCall.tsx +7 -0
  30. package/template/src/components/room-info/useRoomInfo.tsx +5 -0
  31. package/template/src/language/default-labels/videoCallScreenLabels.ts +27 -4
  32. package/template/src/pages/video-call/ActionSheetContent.tsx +77 -77
  33. package/template/src/pages/video-call/SidePanelHeader.tsx +81 -36
  34. package/template/src/rtm/RTMEngine.ts +33 -130
  35. package/template/src/rtm-events/constants.ts +6 -0
  36. package/template/src/rtm-events-api/Events.ts +30 -106
  37. package/template/src/subComponents/caption/Caption.tsx +48 -7
  38. package/template/src/subComponents/caption/CaptionContainer.tsx +324 -51
  39. package/template/src/subComponents/caption/CaptionIcon.tsx +35 -34
  40. package/template/src/subComponents/caption/CaptionText.tsx +103 -2
  41. package/template/src/subComponents/caption/LanguageSelectorPopup.tsx +179 -69
  42. package/template/src/subComponents/caption/Transcript.tsx +46 -11
  43. package/template/src/subComponents/caption/TranscriptIcon.tsx +27 -35
  44. package/template/src/subComponents/caption/TranscriptText.tsx +78 -3
  45. package/template/src/subComponents/caption/proto/ptoto.js +38 -4
  46. package/template/src/subComponents/caption/proto/test.proto +34 -19
  47. package/template/src/subComponents/caption/useCaption.tsx +753 -10
  48. package/template/src/subComponents/caption/useSTTAPI.tsx +118 -205
  49. package/template/src/subComponents/caption/useStreamMessageUtils.native.ts +152 -33
  50. package/template/src/subComponents/caption/useStreamMessageUtils.ts +165 -34
  51. package/template/src/subComponents/caption/utils.ts +171 -3
  52. package/template/src/utils/SdkEvents.ts +3 -0
  53. package/template/src/utils/useEndCall.ts +3 -5
  54. package/template/src/utils/useSpeechToText.ts +31 -20
  55. package/template/agora-rn-uikit/src/Reducer/Spotlight.ts +0 -11
  56. package/template/agora-rn-uikit/src/Reducer/UserBanned.ts +0 -11
  57. package/template/bridge/rtm/web/index-legacy.ts +0 -540
  58. package/template/src/components/RTMConfigure-legacy.tsx +0 -848
@@ -33,7 +33,7 @@ export interface PreCallJoinCallBtnProps {
33
33
 
34
34
  const JoinCallBtn = (props: PreCallJoinCallBtnProps) => {
35
35
  const {rtcProps} = useContext(PropsContext);
36
- const {setCallActive} = usePreCall();
36
+ const {setCallActive, setIsNameIsEmpty} = usePreCall();
37
37
  const username = useGetName();
38
38
  const {isJoinDataFetched} = useRoomInfo();
39
39
  const joinRoomButton =
@@ -58,12 +58,17 @@ const JoinCallBtn = (props: PreCallJoinCallBtnProps) => {
58
58
  }, [rtcProps?.role]);
59
59
 
60
60
  const onSubmit = () => {
61
+ if (!username || (username && username?.trim() === '')) {
62
+ setIsNameIsEmpty(true);
63
+ return;
64
+ }
65
+ setIsNameIsEmpty(false);
61
66
  setCallActive(true);
62
67
  };
63
68
 
64
69
  const title = buttonText;
65
70
  const onPress = () => onSubmit();
66
- const disabled = !isJoinDataFetched || username === '';
71
+ const disabled = !isJoinDataFetched;
67
72
  return props?.render ? (
68
73
  props.render(onPress, title, disabled)
69
74
  ) : (
@@ -42,7 +42,7 @@ export interface PreCallJoinCallBtnProps {
42
42
 
43
43
  const JoinCallBtn = (props: PreCallJoinCallBtnProps) => {
44
44
  const {rtcProps} = useContext(PropsContext);
45
- const {setCallActive} = usePreCall();
45
+ const {setCallActive, setIsNameIsEmpty} = usePreCall();
46
46
  const username = useGetName();
47
47
  const setUsername = useSetName();
48
48
  const {isJoinDataFetched} = useRoomInfo();
@@ -59,6 +59,11 @@ const JoinCallBtn = (props: PreCallJoinCallBtnProps) => {
59
59
  );
60
60
 
61
61
  const onSubmit = () => {
62
+ if (!username || (username && username?.trim() === '')) {
63
+ setIsNameIsEmpty(true);
64
+ return;
65
+ }
66
+ setIsNameIsEmpty(false);
62
67
  logger.log(
63
68
  LogSource.Internals,
64
69
  'PRECALL_SCREEN',
@@ -95,7 +100,7 @@ const JoinCallBtn = (props: PreCallJoinCallBtnProps) => {
95
100
 
96
101
  const title = buttonText;
97
102
  const onPress = () => onSubmit();
98
- const disabled = !isJoinDataFetched || username?.trim() === '';
103
+ const disabled = !isJoinDataFetched;
99
104
  return props?.render ? (
100
105
  props.render(onPress, title, disabled)
101
106
  ) : (
@@ -58,7 +58,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
58
58
  const waitingRoomUsersInCallText = useString(waitingRoomUsersInCall);
59
59
  let pollingTimeout = React.useRef(null);
60
60
  const {rtcProps} = useContext(PropsContext);
61
- const {setCallActive, callActive} = usePreCall();
61
+ const {setCallActive, callActive, setIsNameIsEmpty} = usePreCall();
62
62
  const username = useGetName();
63
63
  const {isJoinDataFetched, isInWaitingRoom} = useRoomInfo();
64
64
  const {setRoomInfo} = useSetRoomInfo();
@@ -212,6 +212,11 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
212
212
  };
213
213
 
214
214
  const onSubmit = () => {
215
+ if (!username || (username && username?.trim() === '')) {
216
+ setIsNameIsEmpty(true);
217
+ return;
218
+ }
219
+ setIsNameIsEmpty(false);
215
220
  shouldWaitingRoomPoll = true;
216
221
  // Enter waiting rooom;
217
222
  setRoomInfo(prev => {
@@ -232,8 +237,8 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
232
237
  const title = buttonText;
233
238
  const onPress = () => onSubmit();
234
239
  const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
235
- ? !hasHostJoined || isInWaitingRoom || username?.trim() === ''
236
- : isInWaitingRoom || username?.trim() === '';
240
+ ? !hasHostJoined || isInWaitingRoom
241
+ : isInWaitingRoom;
237
242
  return props?.render ? (
238
243
  props.render(onPress, title, disabled)
239
244
  ) : (
@@ -45,6 +45,8 @@ import {
45
45
  waitingRoomHostNotJoined,
46
46
  waitingRoomUsersInCall,
47
47
  } from '../../language/default-labels/videoCallScreenLabels';
48
+ import SDKEvents from '../../utils/SdkEvents';
49
+ import isSDK from '../../utils/isSDK';
48
50
 
49
51
  const audio = new Audio(
50
52
  'https://dl.dropboxusercontent.com/s/1cdwpm3gca9mlo0/kick.mp3',
@@ -69,7 +71,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
69
71
  const waitingRoomUsersInCallText = useString(waitingRoomUsersInCall);
70
72
  let pollingTimeout = React.useRef(null);
71
73
  const {rtcProps} = useContext(PropsContext);
72
- const {setCallActive, callActive} = usePreCall();
74
+ const {setCallActive, callActive, setIsNameIsEmpty} = usePreCall();
73
75
  const username = useGetName();
74
76
  const setUsername = useSetName();
75
77
  const {isJoinDataFetched, isInWaitingRoom} = useRoomInfo();
@@ -150,6 +152,10 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
150
152
  });
151
153
 
152
154
  if (approved) {
155
+ if (isSDK()) {
156
+ //emit SDKEvent waiting-room-approval-granted
157
+ SDKEvents.emit('waiting-room-approval-granted');
158
+ }
153
159
  setRoomInfo(prev => {
154
160
  return {
155
161
  ...prev,
@@ -189,6 +195,10 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
189
195
  };
190
196
  });
191
197
  } else {
198
+ if (isSDK()) {
199
+ //emit SDKEvent waiting-room-approval-rejected
200
+ SDKEvents.emit('waiting-room-approval-rejected');
201
+ }
192
202
  setRoomInfo(prev => {
193
203
  return {
194
204
  ...prev,
@@ -236,6 +246,11 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
236
246
  };
237
247
 
238
248
  const onSubmit = () => {
249
+ if (!username || (username && username?.trim() === '')) {
250
+ setIsNameIsEmpty(true);
251
+ return;
252
+ }
253
+ setIsNameIsEmpty(false);
239
254
  shouldWaitingRoomPoll = true;
240
255
  setUsername(username.trim());
241
256
  //setCallActive(true);
@@ -252,7 +267,10 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
252
267
 
253
268
  // join request API to server, server will send RTM message to all hosts regarding request from this user,
254
269
  requestServerToJoinRoom();
255
-
270
+ if (isSDK()) {
271
+ //emit SDKEvent waiting for approval
272
+ SDKEvents.emit('waiting-room-approval-requested');
273
+ }
256
274
  // Play a sound to avoid autoblocking in safari
257
275
  if (isWebInternal() || isMobileOrTablet()) {
258
276
  audio.volume = 0;
@@ -281,8 +299,8 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
281
299
  const title = buttonText;
282
300
  const onPress = () => onSubmit();
283
301
  const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
284
- ? !hasHostJoined || isInWaitingRoom || username?.trim() === ''
285
- : isInWaitingRoom || username?.trim() === '';
302
+ ? !hasHostJoined || isInWaitingRoom
303
+ : isInWaitingRoom;
286
304
  return props?.render ? (
287
305
  props.render(onPress, title, disabled)
288
306
  ) : (
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import React from 'react';
14
- import {TextStyle} from 'react-native';
14
+ import {TextStyle, Text} from 'react-native';
15
15
  import TextInput from '../../atoms/TextInput';
16
16
  import {useString} from '../../utils/useString';
17
17
  import {useRoomInfo} from '../room-info/useRoomInfo';
@@ -25,6 +25,7 @@ import {
25
25
  precallNameInputPlaceholderText,
26
26
  precallYouAreJoiningAsHeading,
27
27
  } from '../../language/default-labels/precallScreenLabels';
28
+ import {usePreCall} from './usePreCall';
28
29
 
29
30
  export interface PreCallTextInputProps {
30
31
  labelStyle?: TextStyle;
@@ -39,30 +40,52 @@ const PreCallTextInput = (props?: PreCallTextInputProps) => {
39
40
  const username = useGetName();
40
41
  const setUsername = useSetName();
41
42
  const {isJoinDataFetched, isInWaitingRoom} = useRoomInfo();
43
+ const {isNameIsEmpty, setIsNameIsEmpty} = usePreCall();
42
44
  const {isDesktop = false, isOnPrecall = false} = props;
43
45
 
44
46
  return (
45
- <Input
46
- maxLength={maxInputLimit}
47
- label={isOnPrecall ? '' : isDesktop ? joiningAs : ''}
48
- labelStyle={
49
- props?.labelStyle
50
- ? props.labelStyle
51
- : {
52
- fontFamily: ThemeConfig.FontFamily.sansPro,
53
- fontWeight: '400',
54
- fontSize: ThemeConfig.FontSize.small,
55
- lineHeight: ThemeConfig.FontSize.small,
56
- color: $config.FONT_COLOR,
57
- }
58
- }
59
- value={username}
60
- autoFocus
61
- onChangeText={text => setUsername(text ? text : '')}
62
- onSubmitEditing={() => {}}
63
- placeholder={isJoinDataFetched ? placeHolder : fetchingNamePlaceholder}
64
- editable={!isInWaitingRoom && isJoinDataFetched}
65
- />
47
+ <>
48
+ <Input
49
+ maxLength={maxInputLimit}
50
+ label={isOnPrecall ? '' : isDesktop ? joiningAs : ''}
51
+ labelStyle={
52
+ props?.labelStyle
53
+ ? props.labelStyle
54
+ : {
55
+ fontFamily: ThemeConfig.FontFamily.sansPro,
56
+ fontWeight: '400',
57
+ fontSize: ThemeConfig.FontSize.small,
58
+ lineHeight: ThemeConfig.FontSize.small,
59
+ color: $config.FONT_COLOR,
60
+ }
61
+ }
62
+ value={username}
63
+ autoFocus
64
+ onChangeText={text => {
65
+ setUsername(text ? text : '');
66
+ if (text && text.trim() === '') {
67
+ setIsNameIsEmpty(true);
68
+ } else {
69
+ setIsNameIsEmpty(false);
70
+ }
71
+ }}
72
+ onSubmitEditing={() => {}}
73
+ placeholder={isJoinDataFetched ? placeHolder : fetchingNamePlaceholder}
74
+ editable={!isInWaitingRoom && isJoinDataFetched}
75
+ style={isNameIsEmpty ? {borderColor: $config.SEMANTIC_ERROR} : {}}
76
+ />
77
+ {isNameIsEmpty && (
78
+ <Text
79
+ style={{
80
+ color: $config.SEMANTIC_ERROR,
81
+ fontFamily: ThemeConfig.FontFamily.sansPro,
82
+ marginTop: 4,
83
+ marginLeft: 4,
84
+ }}>
85
+ {'Name is required'}
86
+ </Text>
87
+ )}
88
+ </>
66
89
  );
67
90
  };
68
91
 
@@ -29,6 +29,8 @@ export interface PreCallContextInterface {
29
29
  setSpeakerAvailable: React.Dispatch<React.SetStateAction<boolean>>;
30
30
  isPermissionRequested: boolean;
31
31
  setIsPermissionRequested: React.Dispatch<React.SetStateAction<boolean>>;
32
+ isNameIsEmpty: boolean;
33
+ setIsNameIsEmpty: React.Dispatch<React.SetStateAction<boolean>>;
32
34
  }
33
35
 
34
36
  const PreCallContext = createContext<PreCallContextInterface>({
@@ -42,6 +44,8 @@ const PreCallContext = createContext<PreCallContextInterface>({
42
44
  setSpeakerAvailable: () => {},
43
45
  isPermissionRequested: false,
44
46
  setIsPermissionRequested: () => {},
47
+ isNameIsEmpty: false,
48
+ setIsNameIsEmpty: () => {},
45
49
  });
46
50
 
47
51
  interface PreCallProviderProps {
@@ -54,6 +58,7 @@ const PreCallProvider = (props: PreCallProviderProps) => {
54
58
  const roomInfo = useRoomInfo();
55
59
  const {deviceList} = useContext(DeviceContext);
56
60
  const setUsername = useSetName();
61
+ const [isNameIsEmpty, setIsNameIsEmpty] = useState(false);
57
62
  const [isCameraAvailable, setCameraAvailable] = useState(false);
58
63
  const [isMicAvailable, setMicAvailable] = useState(false);
59
64
  const [isSpeakerAvailable, setSpeakerAvailable] = useState(false);
@@ -69,6 +74,8 @@ const PreCallProvider = (props: PreCallProviderProps) => {
69
74
  setSpeakerAvailable,
70
75
  isPermissionRequested,
71
76
  setIsPermissionRequested,
77
+ isNameIsEmpty,
78
+ setIsNameIsEmpty,
72
79
  };
73
80
 
74
81
  useEffect(() => {
@@ -103,6 +103,11 @@ export interface RoomInfoContextInterface {
103
103
  newLang?: LanguageType[];
104
104
  uid?: UidType;
105
105
  langChanged?: boolean;
106
+ remoteLang?: LanguageType[];
107
+ translateConfig?: {
108
+ target_lang: string[];
109
+ source_lang: string;
110
+ }[];
106
111
  };
107
112
  isSTTActive?: boolean;
108
113
  roomPreference?: joinRoomPreference;
@@ -197,8 +197,15 @@ export const sttChangeLanguagePopupPrimaryBtnText =
197
197
 
198
198
  export const sttChangeSpokenLanguageText =
199
199
  `${stt}ChangeSpokenLanguageText` as const;
200
+ export const sttStopTranslationText = `${stt}StopTranslationText` as const;
201
+ export const sttOriginalTranslatedText =
202
+ `${stt}sttOriginalTranslatedText` as const;
200
203
  export const sttSettingSpokenLanguageText =
201
204
  `${stt}SettingSpokenLanguageText` as const;
205
+ export const sttSettingTranslationLanguageText =
206
+ `${stt}SettingTranslationLanguageText` as const;
207
+ export const sttChangeTranslationLanguageText =
208
+ `${stt}ChangeTranslationLanguageText` as const;
202
209
  export const sttTranscriptPanelHeaderText =
203
210
  `${stt}TranscriptPanelHeaderText` as const;
204
211
  export const sttDownloadBtnText = `${stt}DownloadBtnText` as const;
@@ -206,6 +213,8 @@ export const sttDownloadTranscriptBtnText =
206
213
  `${stt}DownloadTranscriptBtnText` as const;
207
214
  export const sttLanguageChangeInProgress =
208
215
  `${stt}LanguageChangeInProgress` as const;
216
+ export const sttStartError = `${stt}StartError` as const;
217
+ export const sttUpdateError = `${stt}UpdateError` as const;
209
218
 
210
219
  export const chatPanelGroupTabText = 'chatPanelGroupTabText';
211
220
  export const chatPanelPrivateTabText = 'chatPanelPrivateTabText';
@@ -637,11 +646,17 @@ export interface I18nVideoCallScreenLabelsInterface {
637
646
  [sttChangeLanguagePopupPrimaryBtnText]?: I18nBaseType;
638
647
 
639
648
  [sttChangeSpokenLanguageText]?: I18nBaseType;
649
+ [sttStopTranslationText]?: I18nBaseType;
650
+ [sttOriginalTranslatedText]?: I18nBaseType;
640
651
  [sttSettingSpokenLanguageText]?: I18nBaseType;
652
+ [sttSettingTranslationLanguageText]?: I18nConditionalType;
653
+ [sttChangeTranslationLanguageText]?: I18nBaseType;
641
654
  [sttTranscriptPanelHeaderText]?: I18nBaseType;
642
655
  [sttDownloadBtnText]?: I18nBaseType;
643
656
  [sttDownloadTranscriptBtnText]?: I18nBaseType;
644
657
  [sttLanguageChangeInProgress]?: I18nBaseType;
658
+ [sttStartError]?: I18nBaseType;
659
+ [sttUpdateError]?: I18nBaseType;
645
660
 
646
661
  [peoplePanelHeaderText]?: I18nBaseType;
647
662
 
@@ -1027,21 +1042,29 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
1027
1042
 
1028
1043
  [textTrackModalTitleIntn]: 'Text Tracks',
1029
1044
  [sttChangeLanguagePopupHeading]: isFirstTimeOpened =>
1030
- isFirstTimeOpened ? 'Set Spoken Language' : 'Change Spoken Language',
1045
+ isFirstTimeOpened
1046
+ ? 'Setup Captions & Translation'
1047
+ : 'Modify Captions & Translation',
1031
1048
  [sttChangeLanguagePopupSubHeading]:
1032
- 'What language(s) are being spoken by everyone in this meeting?',
1049
+ 'Please select your preferred language as the source language and up to 10 target languages to translate into. You can update these settings at any time by returning to this page.',
1033
1050
  [sttChangeLanguagePopupPrimaryBtnText]: 'CONFIRM',
1034
1051
  [sttChangeLanguagePopupDropdownInfo]:
1035
- 'You can choose a maximum of two languages',
1052
+ 'You can choose a maximum of ten languages',
1036
1053
  [sttChangeLanguagePopupDropdownError]:
1037
1054
  'Choose at least one language to proceed',
1038
1055
  [sttChangeSpokenLanguageText]: 'Change Spoken Language',
1039
-
1056
+ [sttStopTranslationText]: 'Stop Translation',
1057
+ [sttOriginalTranslatedText]: 'Show Original and translated',
1040
1058
  [sttTranscriptPanelHeaderText]: 'Meeting Transcript',
1041
1059
  [sttDownloadBtnText]: 'Download',
1042
1060
  [sttDownloadTranscriptBtnText]: 'Download Transcript',
1043
1061
  [sttSettingSpokenLanguageText]: 'Setting Spoken Language',
1062
+ [sttSettingTranslationLanguageText]: (isUpdate: boolean) =>
1063
+ isUpdate ? 'Updating Translation Language' : 'Setting Translation Language',
1064
+ [sttChangeTranslationLanguageText]: 'Change Translation Language',
1044
1065
  [sttLanguageChangeInProgress]: 'Language Change is in progress...',
1066
+ [sttStartError]: 'Failed to start captions',
1067
+ [sttUpdateError]: 'Failed to update caption settings',
1045
1068
 
1046
1069
  [peoplePanelHeaderText]: 'People',
1047
1070
 
@@ -207,7 +207,7 @@ const ActionSheetContent = props => {
207
207
 
208
208
  const {localUid} = useContext(ChatContext);
209
209
  const {rtcProps} = useContext(PropsContext);
210
- const {setRoomInfo} = useSetRoomInfo();
210
+ // const {setRoomInfo} = useSetRoomInfo();
211
211
  const {
212
212
  data: {isHost},
213
213
  sttLanguage,
@@ -216,90 +216,90 @@ const ActionSheetContent = props => {
216
216
  const {isPendingRequestToReview, raiseHandList} =
217
217
  useContext(LiveStreamContext);
218
218
  const {totalUnreadCount} = useChatNotification();
219
- const {setIsSTTActive, setLanguage, setMeetingTranscript} = useCaption();
219
+ // const {setIsSTTActive, setLanguage, setMeetingTranscript} = useCaption();
220
220
  const {defaultContent} = useContent();
221
221
  const {waitingRoomUids} = useWaitingRoomContext();
222
222
  const defaultContentRef = React.useRef(defaultContent);
223
- const {addStreamMessageListener} = useSpeechToText();
223
+ // const {addStreamMessageListener} = useSpeechToText();
224
224
 
225
225
  React.useEffect(() => {
226
226
  defaultContentRef.current = defaultContent;
227
227
  }, [defaultContent]);
228
228
 
229
- //STT events on mount
230
-
231
- React.useEffect(() => {
232
- setIsSTTActive(isSTTActive);
233
- }, [isSTTActive]);
234
-
235
- React.useEffect(() => {
236
- // for mobile events are set in ActionSheetContent
237
- if (!sttLanguage) return;
238
- const {
239
- username,
240
- prevLang,
241
- newLang,
242
- uid,
243
- langChanged,
244
- }: RoomInfoContextInterface['sttLanguage'] = sttLanguage;
245
- if (!langChanged) return;
246
- const actionText =
247
- prevLang.indexOf('') !== -1
248
- ? `has set the spoken language to "${getLanguageLabel(newLang)}" `
249
- : `changed the spoken language from "${getLanguageLabel(
250
- prevLang,
251
- )}" to "${getLanguageLabel(newLang)}" `;
252
- const msg = `${
253
- defaultContentRef.current[uid]?.name || username
254
- } ${actionText} `;
255
-
256
- let subheadingObj: any = {};
257
- if (prevLang.indexOf('') !== -1) {
258
- subheadingObj = {
259
- username: defaultContentRef.current[uid]?.name || username,
260
- action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
261
- newLanguage: getLanguageLabel(newLang),
262
- };
263
- } else {
264
- subheadingObj = {
265
- username: defaultContentRef.current[uid]?.name || username,
266
- action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
267
- newLanguage: getLanguageLabel(newLang),
268
- oldLanguage: getLanguageLabel(prevLang),
269
- };
270
- }
271
- Toast.show({
272
- leadingIconName: 'lang-select',
273
- type: 'info',
274
- text1: heading(prevLang.indexOf('') !== -1 ? 'Set' : 'Changed'),
275
- visibilityTime: 3000,
276
- primaryBtn: null,
277
- secondaryBtn: null,
278
- text2: subheading(subheadingObj),
279
- });
280
- setRoomInfo(prev => {
281
- return {
282
- ...prev,
283
- sttLanguage: {...sttLanguage, langChanged: false},
284
- };
285
- });
286
- // syncing local set language
287
- newLang && setLanguage(newLang);
288
- // add spoken lang msg to transcript
289
- setMeetingTranscript(prev => {
290
- return [
291
- ...prev,
292
- {
293
- name: 'langUpdate',
294
- time: new Date().getTime(),
295
- uid: `langUpdate-${uid}`,
296
- text: actionText,
297
- },
298
- ];
299
- });
300
- // start listening to stream Message callback
301
- addStreamMessageListener();
302
- }, [sttLanguage]);
229
+ // STT events on mount
230
+
231
+ // React.useEffect(() => {
232
+ // setIsSTTActive(isSTTActive);
233
+ // }, [isSTTActive]);
234
+
235
+ // React.useEffect(() => {
236
+ // // for mobile events are set in ActionSheetContent
237
+ // if (!sttLanguage) return;
238
+ // const {
239
+ // username,
240
+ // prevLang,
241
+ // newLang,
242
+ // uid,
243
+ // langChanged,
244
+ // }: RoomInfoContextInterface['sttLanguage'] = sttLanguage;
245
+ // if (!langChanged) return;
246
+ // const actionText =
247
+ // prevLang.indexOf('') !== -1
248
+ // ? `has set the spoken language to "${getLanguageLabel(newLang)}" `
249
+ // : `changed the spoken language from "${getLanguageLabel(
250
+ // prevLang,
251
+ // )}" to "${getLanguageLabel(newLang)}" `;
252
+ // const msg = `${
253
+ // defaultContentRef.current[uid]?.name || username
254
+ // } ${actionText} `;
255
+
256
+ // let subheadingObj: any = {};
257
+ // if (prevLang.indexOf('') !== -1) {
258
+ // subheadingObj = {
259
+ // username: defaultContentRef.current[uid]?.name || username,
260
+ // action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
261
+ // newLanguage: getLanguageLabel(newLang),
262
+ // };
263
+ // } else {
264
+ // subheadingObj = {
265
+ // username: defaultContentRef.current[uid]?.name || username,
266
+ // action: prevLang.indexOf('') !== -1 ? 'Set' : 'Changed',
267
+ // newLanguage: getLanguageLabel(newLang),
268
+ // oldLanguage: getLanguageLabel(prevLang),
269
+ // };
270
+ // }
271
+ // Toast.show({
272
+ // leadingIconName: 'lang-select',
273
+ // type: 'info',
274
+ // text1: heading(prevLang.indexOf('') !== -1 ? 'Set' : 'Changed'),
275
+ // visibilityTime: 3000,
276
+ // primaryBtn: null,
277
+ // secondaryBtn: null,
278
+ // text2: subheading(subheadingObj),
279
+ // });
280
+ // setRoomInfo(prev => {
281
+ // return {
282
+ // ...prev,
283
+ // sttLanguage: {...sttLanguage, langChanged: false},
284
+ // };
285
+ // });
286
+ // // syncing local set language
287
+ // // newLang && setLanguage(newLang);
288
+ // // add spoken lang msg to transcript
289
+ // setMeetingTranscript(prev => {
290
+ // return [
291
+ // ...prev,
292
+ // {
293
+ // name: 'langUpdate',
294
+ // time: new Date().getTime(),
295
+ // uid: `langUpdate-${uid}`,
296
+ // text: actionText,
297
+ // },
298
+ // ];
299
+ // });
300
+ // // start listening to stream Message callback
301
+ // addStreamMessageListener();
302
+ // }, [sttLanguage]);
303
303
 
304
304
  const isLiveStream = $config.EVENT_MODE && !$config.AUDIO_ROOM;
305
305
  const isAudience = rtcProps?.role === ClientRoleType.ClientRoleAudience;