agora-appbuilder-core 4.0.0-beta.24 → 4.0.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-beta.24",
3
+ "version": "4.0.0-beta.25",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -77,13 +77,11 @@ const MoreButton = () => {
77
77
  const {currentLayout, setLayout} = useLayout();
78
78
  const layout = layouts.findIndex(item => item.name === currentLayout);
79
79
  const {setSidePanel, sidePanel} = useSidePanel();
80
- const username = useGetName();
81
80
  const {
82
81
  isCaptionON,
83
- isSTTActive,
84
82
  setIsCaptionON,
85
- setLanguage,
86
83
  language: prevLang,
84
+ isSTTActive,
87
85
  } = useCaption();
88
86
 
89
87
  const isTranscriptON = sidePanel === SidePanelType.Transcript;
@@ -93,10 +91,11 @@ const MoreButton = () => {
93
91
  const isFirstTimePopupOpen = React.useRef(false);
94
92
  const STT_clicked = React.useRef(null);
95
93
 
96
- const {start, restart, isAuthorizedSTTUser} = useSTTAPI();
94
+ const {start, restart} = useSTTAPI();
97
95
  const {
98
96
  data: {isHost},
99
97
  } = useMeetingInfo();
98
+
100
99
  const {
101
100
  showLayoutOption,
102
101
  setShowInvitePopup,
@@ -115,7 +114,7 @@ const MoreButton = () => {
115
114
  icon: `${isCaptionON ? 'captions-off' : 'captions'}`,
116
115
  iconColor: $config.SECONDARY_ACTION_COLOR,
117
116
  textColor: $config.FONT_COLOR,
118
- disabled: !isAuthorizedSTTUser(),
117
+ disabled: !($config.ENABLE_STT && (isHost || (!isHost && isSTTActive))),
119
118
  title: `${isCaptionON ? 'Hide Caption' : 'Show Caption'}`,
120
119
  callback: () => {
121
120
  setActionMenuVisible(false);
@@ -134,7 +133,7 @@ const MoreButton = () => {
134
133
  icon: 'transcript',
135
134
  iconColor: $config.SECONDARY_ACTION_COLOR,
136
135
  textColor: $config.FONT_COLOR,
137
- disabled: !isAuthorizedSTTUser(),
136
+ disabled: !($config.ENABLE_STT && (isHost || (!isHost && isSTTActive))),
138
137
  title: `${isTranscriptON ? 'Hide Transcript' : 'Show Transcript'}`,
139
138
  callback: () => {
140
139
  setActionMenuVisible(false);
@@ -352,8 +351,7 @@ const MoreButton = () => {
352
351
  }}
353
352
  onMouseLeave={() => {
354
353
  setIsHovered(false);
355
- }}
356
- >
354
+ }}>
357
355
  {/** placeholder to hovering */}
358
356
  <View
359
357
  style={{
@@ -389,7 +387,6 @@ const Controls = () => {
389
387
  const {rtcProps} = useContext(PropsContext);
390
388
  const isDesktop = useIsDesktop();
391
389
  // attendee can view option if any host has started STT
392
- const {isAuthorizedSTTUser} = useSTTAPI();
393
390
  const {renderList} = useRender();
394
391
  const {
395
392
  data: {isHost},
@@ -402,14 +399,16 @@ const Controls = () => {
402
399
  renderListRef.current = renderList;
403
400
  }, [renderList]);
404
401
 
402
+ React.useEffect(() => {
403
+ events.on(EventNames.STT_ACTIVE, data => {
404
+ const payload = JSON.parse(data?.payload);
405
+ setIsSTTActive(payload.active);
406
+ });
407
+ }, []);
408
+
405
409
  React.useEffect(() => {
406
410
  // for native events are set in ActionSheetContent as this action is action sheet
407
411
  if (isWebInternal()) {
408
- events.on(EventNames.STT_ACTIVE, data => {
409
- const payload = JSON.parse(data?.payload);
410
- setIsSTTActive(payload.active);
411
- });
412
-
413
412
  events.on(EventNames.STT_LANGUAGE, data => {
414
413
  const {username, prevLang, newLang, uid} = JSON.parse(data?.payload);
415
414
  const actionText =
@@ -465,15 +464,13 @@ const Controls = () => {
465
464
  {
466
465
  paddingHorizontal: isDesktop('toolbar') ? 32 : 16,
467
466
  },
468
- ]}
469
- >
467
+ ]}>
470
468
  {width >= BREAKPOINTS.md && (
471
469
  <View style={style.leftContent}>
472
470
  <View
473
471
  testID="layout-btn"
474
472
  style={{marginRight: 10}}
475
- collapsable={false}
476
- >
473
+ collapsable={false}>
477
474
  {/**
478
475
  * .measure returns undefined on Android unless collapsable=false or onLayout are specified
479
476
  * so added collapsable property
@@ -517,8 +514,7 @@ const Controls = () => {
517
514
  testID="localVideo-btn"
518
515
  style={{
519
516
  marginHorizontal: 10,
520
- }}
521
- >
517
+ }}>
522
518
  <LocalVideoMute showToolTip={true} />
523
519
  </View>
524
520
  )}
@@ -527,8 +523,7 @@ const Controls = () => {
527
523
  testID="switchCamera-btn"
528
524
  style={{
529
525
  marginHorizontal: 10,
530
- }}
531
- >
526
+ }}>
532
527
  <LocalSwitchCamera />
533
528
  </View>
534
529
  )}
@@ -539,8 +534,7 @@ const Controls = () => {
539
534
  testID="screenShare-btn"
540
535
  style={{
541
536
  marginHorizontal: 10,
542
- }}
543
- >
537
+ }}>
544
538
  <ScreenshareButton />
545
539
  </View>
546
540
  )}
@@ -549,8 +543,7 @@ const Controls = () => {
549
543
  testID="recording-btn"
550
544
  style={{
551
545
  marginHorizontal: 10,
552
- }}
553
- >
546
+ }}>
554
547
  <Recording />
555
548
  </View>
556
549
  )}
@@ -280,9 +280,15 @@ interface CaptionIconBtnProps {
280
280
 
281
281
  const CaptionIconBtn = (props: CaptionIconBtnProps) => {
282
282
  const {showLabel = $config.ICON_TEXT, onPress} = props;
283
- const {isAuthorizedSTTUser} = useSTTAPI();
284
- const {isCaptionON} = useCaption();
285
- const isDisabled = !isAuthorizedSTTUser();
283
+ const {isCaptionON, isSTTActive} = useCaption();
284
+ const {
285
+ data: {isHost},
286
+ } = useMeetingInfo();
287
+
288
+ const isDisabled = !(
289
+ $config.ENABLE_STT &&
290
+ (isHost || (!isHost && isSTTActive))
291
+ );
286
292
  return (
287
293
  <View style={styles.iconWithText}>
288
294
  <View style={styles.iconContainer}>
@@ -329,10 +335,18 @@ interface TranscriptIconProps {
329
335
 
330
336
  const TranscriptIconBtn = (props: TranscriptIconProps) => {
331
337
  const {showLabel = $config.ICON_TEXT} = props;
332
- const {isAuthorizedSTTUser} = useSTTAPI();
333
338
  const {sidePanel} = useSidePanel();
334
339
  const isTranscriptON = sidePanel === SidePanelType.Transcript;
335
- const isDisabled = !isAuthorizedSTTUser();
340
+ const {isSTTActive} = useCaption();
341
+ const {
342
+ data: {isHost},
343
+ } = useMeetingInfo();
344
+
345
+ const isDisabled = !(
346
+ $config.ENABLE_STT &&
347
+ (isHost || (!isHost && isSTTActive))
348
+ );
349
+
336
350
  return (
337
351
  <View style={styles.iconWithText}>
338
352
  <View style={styles.iconContainer}>
@@ -419,12 +433,16 @@ const ActionSheetContent = props => {
419
433
  const {renderList} = useRender();
420
434
 
421
435
  //STT events on mount
436
+
422
437
  React.useEffect(() => {
438
+ if (native) return;
423
439
  events.on(EventNames.STT_ACTIVE, data => {
424
440
  const payload = JSON.parse(data?.payload);
425
441
  setIsSTTActive(payload.active);
426
442
  });
427
-
443
+ }, []);
444
+ React.useEffect(() => {
445
+ if (native) return;
428
446
  events.on(EventNames.STT_LANGUAGE, data => {
429
447
  const {username, prevLang, newLang, uid} = JSON.parse(data?.payload);
430
448
  const actionText =
@@ -121,8 +121,8 @@ const Transcript = (props: TranscriptProps) => {
121
121
  // animated: false,
122
122
  // });
123
123
  if (flatListRef.current) {
124
- flatListRef.current.scrollToEnd({animated: false});
125
124
  setShowButton(false);
125
+ flatListRef.current.scrollToEnd({animated: false});
126
126
  isScrolledToEnd.current = true;
127
127
  }
128
128
  };
@@ -266,7 +266,11 @@ const Transcript = (props: TranscriptProps) => {
266
266
  renderItem={renderItem}
267
267
  keyExtractor={item => item.uid + '-' + item.time}
268
268
  onContentSizeChange={handleContentSizeChange}
269
- onScroll={handleScroll}
269
+ onScroll={
270
+ isWebInternal()
271
+ ? debounceFn(handleScroll, isMobileUA() ? 500 : 300)
272
+ : handleScroll
273
+ }
270
274
  onLayout={handleLayout}
271
275
  ListEmptyComponent={searchQuery && <NoResultsMsg />}
272
276
  ListFooterComponent={DownloadTranscriptBtn}
@@ -281,7 +285,9 @@ const Transcript = (props: TranscriptProps) => {
281
285
  keyExtractor={item => item.uid + '-' + item.time}
282
286
  onContentSizeChange={handleContentSizeChange}
283
287
  onScroll={
284
- isWebInternal() ? debounceFn(handleScroll, 200) : handleScroll
288
+ isWebInternal()
289
+ ? debounceFn(handleScroll, isMobileUA() ? 500 : 300)
290
+ : handleScroll
285
291
  }
286
292
  onLayout={handleLayout}
287
293
  ListEmptyComponent={searchQuery && <NoResultsMsg />}