agora-appbuilder-core 4.0.22-beta-2 → 4.0.22-beta-3

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.22-beta-2",
3
+ "version": "4.0.22-beta-3",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -35,4 +35,3 @@ export {default as useLocalAudio} from '../src/utils/useLocalAudio';
35
35
  export {default as useLocalVideo} from '../src/utils/useLocalVideo';
36
36
  export type {LanguageType} from '../src/subComponents/caption/utils';
37
37
  export {default as useSpeechToText} from '../src/utils/useSpeechToText';
38
- export {isMobileUA} from '../src/utils/common';
@@ -10,10 +10,9 @@ interface CarouselItem {
10
10
 
11
11
  interface CarouselProps {
12
12
  data: CarouselItem[];
13
- isPaginationRequired?: boolean;
14
13
  }
15
14
 
16
- const Carousel: React.FC<CarouselProps> = ({data, isPaginationRequired}) => {
15
+ const Carousel: React.FC<CarouselProps> = ({data}) => {
17
16
  const [activeIndex, setActiveIndex] = useState(0);
18
17
 
19
18
  const flatListRef = React.useRef<FlatList | null>(null);
@@ -37,8 +36,7 @@ const Carousel: React.FC<CarouselProps> = ({data, isPaginationRequired}) => {
37
36
  };
38
37
 
39
38
  return (
40
- <View
41
- style={[styles.container, !isPaginationRequired ? {paddingTop: 24} : {}]}>
39
+ <View style={styles.container}>
42
40
  <FlatList
43
41
  ref={flatListRef}
44
42
  data={data}
@@ -49,32 +47,28 @@ const Carousel: React.FC<CarouselProps> = ({data, isPaginationRequired}) => {
49
47
  keyExtractor={(_, index) => index.toString()}
50
48
  onScroll={handleScroll}
51
49
  />
52
- {isPaginationRequired ? (
53
- <View style={styles.indicatorContainer}>
54
- {data.map((_, index) => (
55
- <Pressable
56
- key={index}
57
- onPress={() => {
58
- scrollToIndex(index);
59
- setActiveIndex(index);
60
- }}
61
- hitSlop={5} // to increase clickable area
62
- >
63
- {({pressed}) => (
64
- <View
65
- style={[
66
- styles.dot,
67
- index === activeIndex && styles.activeDot,
68
- pressed && styles.pressedDot,
69
- ]}
70
- />
71
- )}
72
- </Pressable>
73
- ))}
74
- </View>
75
- ) : (
76
- <></>
77
- )}
50
+ <View style={styles.indicatorContainer}>
51
+ {data.map((_, index) => (
52
+ <Pressable
53
+ key={index}
54
+ onPress={() => {
55
+ scrollToIndex(index);
56
+ setActiveIndex(index);
57
+ }}
58
+ hitSlop={5} // to increase clickable area
59
+ >
60
+ {({pressed}) => (
61
+ <View
62
+ style={[
63
+ styles.dot,
64
+ index === activeIndex && styles.activeDot,
65
+ pressed && styles.pressedDot,
66
+ ]}
67
+ />
68
+ )}
69
+ </Pressable>
70
+ ))}
71
+ </View>
78
72
  </View>
79
73
  );
80
74
  };
@@ -7,14 +7,6 @@ import {isMobileUA} from '../utils/common';
7
7
  import NavbarMobile from '../components/NavbarMobile';
8
8
  import ActionSheet from '../pages/video-call/ActionSheet';
9
9
 
10
- export type ToolbarMoreOptionDefaultItemName =
11
- | 'virtual-background'
12
- | 'noise-cancellation'
13
- | 'caption'
14
- | 'transcript'
15
- | 'view-recordings'
16
- | 'whiteboard';
17
-
18
10
  export type ToolbarDefaultItemName =
19
11
  //bottom bar
20
12
 
@@ -43,21 +35,9 @@ export type ToolbarDefaultItemConfig = {
43
35
  [key in ToolbarDefaultItemName]?: ToolbarDefaultItem;
44
36
  };
45
37
 
46
- export type ToolbarMoreButton = {
47
- ['more']?: ToolbarMoreDefaultItem;
48
- };
49
-
50
- export type ToolbarMoreButtonConfig = {
51
- [key in ToolbarMoreOptionDefaultItemName]?: ToolbarDefaultItem;
52
- };
53
-
54
38
  export type ToolbarItemAlign = 'start' | 'center' | 'end';
55
39
  export type ToolbarItemHide = 'yes' | 'no';
56
40
 
57
- export interface ToolbarMoreDefaultItem extends ToolbarDefaultItem {
58
- fields?: ToolbarMoreButtonConfig;
59
- }
60
-
61
41
  export interface ToolbarDefaultItem {
62
42
  component?: () => JSX.Element;
63
43
  align?: ToolbarItemAlign;
@@ -76,13 +56,13 @@ export type ToolbarPresetAlign = 'top' | 'bottom' | 'right' | 'left';
76
56
  export interface ToolbarBottomPresetProps {
77
57
  align: ToolbarPresetAlign;
78
58
  customItems?: Array<ToolbarCustomItem>;
79
- defaultItemsConfig?: ToolbarDefaultItemConfig | ToolbarMoreButton;
59
+ defaultItemsConfig?: ToolbarDefaultItemConfig;
80
60
  snapPointsMinMax: [number, number];
81
61
  }
82
62
  export interface ToolbarOtherPresetProps {
83
63
  align: ToolbarPresetAlign;
84
64
  customItems?: Array<ToolbarCustomItem>;
85
- defaultItemsConfig?: ToolbarDefaultItemConfig | ToolbarMoreButton;
65
+ defaultItemsConfig?: ToolbarDefaultItemConfig;
86
66
  snapPointsMinMax?: never;
87
67
  }
88
68
 
@@ -70,7 +70,6 @@ import useGetName from '../utils/useGetName';
70
70
  import Toolbar from '../atoms/Toolbar';
71
71
  import ToolbarItem from '../atoms/ToolbarItem';
72
72
  import {
73
- ToolbarBottomPresetProps,
74
73
  ToolbarCustomItem,
75
74
  ToolbarDefaultItem,
76
75
  ToolbarDefaultItemConfig,
@@ -251,11 +250,7 @@ export const WhiteboardListener = () => {
251
250
  return null;
252
251
  };
253
252
 
254
- const MoreButton = (props: {
255
- defaultItemsConfig: ToolbarBottomPresetProps['defaultItemsConfig'];
256
- }) => {
257
- const defaultItemsConfig = props?.defaultItemsConfig || {};
258
- const defaultMoreItemsConfig = props?.defaultItemsConfig?.more?.fields || {};
253
+ const MoreButton = () => {
259
254
  const noiseCancellationLabel = useString(toolbarItemNoiseCancellationText)();
260
255
  const whiteboardLabel = useString<boolean>(toolbarItemWhiteboardText);
261
256
  const captionLabel = useString<boolean>(toolbarItemCaptionText);
@@ -321,25 +316,23 @@ const MoreButton = (props: {
321
316
 
322
317
  //AINS
323
318
  if ($config.ENABLE_NOISE_CANCELLATION) {
324
- if (!(defaultMoreItemsConfig['noise-cancellation']?.hide === 'yes')) {
325
- actionMenuitems.push({
326
- toggleStatus: isNoiseSupressionEnabled === ToggleState.enabled,
327
- disabled:
328
- isNoiseSupressionEnabled === ToggleState.disabling ||
329
- isNoiseSupressionEnabled === ToggleState.enabling,
330
- isBase64Icon: true,
331
- //@ts-ignore
332
- icon: 'noise-cancellation',
333
- iconColor: $config.SECONDARY_ACTION_COLOR,
334
- textColor: $config.FONT_COLOR,
335
- title: noiseCancellationLabel,
336
- //isNoiseSupressionEnabled === ToggleState.enabled
337
- callback: () => {
338
- setActionMenuVisible(false);
339
- setNoiseSupression(p => !p);
340
- },
341
- });
342
- }
319
+ actionMenuitems.push({
320
+ toggleStatus: isNoiseSupressionEnabled === ToggleState.enabled,
321
+ disabled:
322
+ isNoiseSupressionEnabled === ToggleState.disabling ||
323
+ isNoiseSupressionEnabled === ToggleState.enabling,
324
+ isBase64Icon: true,
325
+ //@ts-ignore
326
+ icon: 'noise-cancellation',
327
+ iconColor: $config.SECONDARY_ACTION_COLOR,
328
+ textColor: $config.FONT_COLOR,
329
+ title: noiseCancellationLabel,
330
+ //isNoiseSupressionEnabled === ToggleState.enabled
331
+ callback: () => {
332
+ setActionMenuVisible(false);
333
+ setNoiseSupression(p => !p);
334
+ },
335
+ });
343
336
  }
344
337
  //AINS
345
338
 
@@ -355,21 +348,19 @@ const MoreButton = (props: {
355
348
  setIsVBActive(prev => !prev);
356
349
  };
357
350
  if ($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) {
358
- if (!(defaultMoreItemsConfig['virtual-background']?.hide === 'yes')) {
359
- actionMenuitems.push({
360
- isBase64Icon: true,
361
- //@ts-ignore
362
- icon: 'vb',
363
- iconColor: $config.SECONDARY_ACTION_COLOR,
364
- textColor: $config.FONT_COLOR,
365
- //title: `${isVBActive ? 'Hide' : 'Show'} Virtual Background`,
366
- title: virtualBackgroundLabel,
367
- callback: () => {
368
- setActionMenuVisible(false);
369
- toggleVB();
370
- },
371
- });
372
- }
351
+ actionMenuitems.push({
352
+ isBase64Icon: true,
353
+ //@ts-ignore
354
+ icon: 'vb',
355
+ iconColor: $config.SECONDARY_ACTION_COLOR,
356
+ textColor: $config.FONT_COLOR,
357
+ //title: `${isVBActive ? 'Hide' : 'Show'} Virtual Background`,
358
+ title: virtualBackgroundLabel,
359
+ callback: () => {
360
+ setActionMenuVisible(false);
361
+ toggleVB();
362
+ },
363
+ });
373
364
  }
374
365
  //virtual background
375
366
 
@@ -457,47 +448,76 @@ const MoreButton = (props: {
457
448
  //whiteboard ends
458
449
 
459
450
  if (isHost && $config.ENABLE_WHITEBOARD && isWebInternal()) {
460
- if (!(defaultMoreItemsConfig?.whiteboard?.hide === 'yes')) {
461
- actionMenuitems.push({
462
- disabled: WhiteboardDisabled,
463
- isBase64Icon: true,
464
- //@ts-ignore
465
- icon: 'whiteboard-new',
466
- iconColor: $config.SECONDARY_ACTION_COLOR,
467
- textColor: $config.FONT_COLOR,
468
- title: whiteboardLabel(whiteboardActive),
469
- callback: () => {
470
- setActionMenuVisible(false);
471
- toggleWhiteboard(whiteboardActive, true);
472
- },
473
- });
474
- }
451
+ actionMenuitems.push({
452
+ disabled: WhiteboardDisabled,
453
+ isBase64Icon: true,
454
+ //@ts-ignore
455
+ icon: 'whiteboard-new',
456
+ iconColor: $config.SECONDARY_ACTION_COLOR,
457
+ textColor: $config.FONT_COLOR,
458
+ title: whiteboardLabel(whiteboardActive),
459
+ callback: () => {
460
+ setActionMenuVisible(false);
461
+ toggleWhiteboard(whiteboardActive, true);
462
+ },
463
+ });
475
464
  }
476
465
 
477
466
  // host can see stt options and attendee can view only when stt is enabled by a host in the channel
478
467
 
479
468
  if ($config.ENABLE_STT && $config.ENABLE_CAPTION) {
480
- if (!(defaultMoreItemsConfig?.caption?.hide === 'yes')) {
469
+ actionMenuitems.push({
470
+ icon: `${isCaptionON ? 'captions-off' : 'captions'}`,
471
+ iconColor: $config.SECONDARY_ACTION_COLOR,
472
+ textColor: $config.FONT_COLOR,
473
+ disabled: !(
474
+ $config.ENABLE_STT &&
475
+ $config.ENABLE_CAPTION &&
476
+ (isHost || (!isHost && isSTTActive))
477
+ ),
478
+ title: captionLabel(isCaptionON),
479
+ callback: () => {
480
+ setActionMenuVisible(false);
481
+ STT_clicked.current = !isCaptionON ? 'caption' : null;
482
+ if (isSTTError) {
483
+ setIsCaptionON(prev => !prev);
484
+ return;
485
+ }
486
+ if (isSTTActive) {
487
+ setIsCaptionON(prev => !prev);
488
+ // is lang popup has been shown once for any user in meeting
489
+ } else {
490
+ isFirstTimePopupOpen.current = true;
491
+ setLanguagePopup(true);
492
+ }
493
+ },
494
+ });
495
+
496
+ if ($config.ENABLE_MEETING_TRANSCRIPT) {
481
497
  actionMenuitems.push({
482
- icon: `${isCaptionON ? 'captions-off' : 'captions'}`,
498
+ icon: 'transcript',
483
499
  iconColor: $config.SECONDARY_ACTION_COLOR,
484
500
  textColor: $config.FONT_COLOR,
485
501
  disabled: !(
486
502
  $config.ENABLE_STT &&
487
503
  $config.ENABLE_CAPTION &&
504
+ $config.ENABLE_MEETING_TRANSCRIPT &&
488
505
  (isHost || (!isHost && isSTTActive))
489
506
  ),
490
- title: captionLabel(isCaptionON),
507
+ title: transcriptLabel(isTranscriptON),
491
508
  callback: () => {
492
509
  setActionMenuVisible(false);
493
- STT_clicked.current = !isCaptionON ? 'caption' : null;
510
+ STT_clicked.current = !isTranscriptON ? 'transcript' : null;
494
511
  if (isSTTError) {
495
- setIsCaptionON(prev => !prev);
512
+ !isTranscriptON
513
+ ? setSidePanel(SidePanelType.Transcript)
514
+ : setSidePanel(SidePanelType.None);
496
515
  return;
497
516
  }
498
517
  if (isSTTActive) {
499
- setIsCaptionON(prev => !prev);
500
- // is lang popup has been shown once for any user in meeting
518
+ !isTranscriptON
519
+ ? setSidePanel(SidePanelType.Transcript)
520
+ : setSidePanel(SidePanelType.None);
501
521
  } else {
502
522
  isFirstTimePopupOpen.current = true;
503
523
  setLanguagePopup(true);
@@ -505,87 +525,45 @@ const MoreButton = (props: {
505
525
  },
506
526
  });
507
527
  }
508
- if ($config.ENABLE_MEETING_TRANSCRIPT) {
509
- if (!(defaultMoreItemsConfig?.transcript?.hide === 'yes')) {
510
- actionMenuitems.push({
511
- icon: 'transcript',
512
- iconColor: $config.SECONDARY_ACTION_COLOR,
513
- textColor: $config.FONT_COLOR,
514
- disabled: !(
515
- $config.ENABLE_STT &&
516
- $config.ENABLE_CAPTION &&
517
- $config.ENABLE_MEETING_TRANSCRIPT &&
518
- (isHost || (!isHost && isSTTActive))
519
- ),
520
- title: transcriptLabel(isTranscriptON),
521
- callback: () => {
522
- setActionMenuVisible(false);
523
- STT_clicked.current = !isTranscriptON ? 'transcript' : null;
524
- if (isSTTError) {
525
- !isTranscriptON
526
- ? setSidePanel(SidePanelType.Transcript)
527
- : setSidePanel(SidePanelType.None);
528
- return;
529
- }
530
- if (isSTTActive) {
531
- !isTranscriptON
532
- ? setSidePanel(SidePanelType.Transcript)
533
- : setSidePanel(SidePanelType.None);
534
- } else {
535
- isFirstTimePopupOpen.current = true;
536
- setLanguagePopup(true);
537
- }
538
- },
539
- });
540
- }
541
- }
542
528
  }
543
529
 
544
530
  // view recordings
545
531
 
546
532
  if (isHost && $config.CLOUD_RECORDING && isWeb()) {
547
- if (!(defaultMoreItemsConfig?.['view-recordings']?.hide === 'yes')) {
548
- actionMenuitems.push({
549
- icon: 'play-circle',
550
- iconColor: $config.SECONDARY_ACTION_COLOR,
551
- textColor: $config.FONT_COLOR,
552
- title: viewRecordingsLabel,
553
- callback: () => {
554
- toggleVRModal();
555
- },
556
- });
557
- }
558
- }
559
-
560
- if (globalWidth <= BREAKPOINTS.lg) {
561
- if (!(defaultItemsConfig?.participant?.hide === 'yes')) {
562
- actionMenuitems.push({
563
- icon: 'participants',
564
- iconColor: $config.SECONDARY_ACTION_COLOR,
565
- textColor: $config.FONT_COLOR,
566
- title: peopleLabel,
567
- callback: () => {
568
- setActionMenuVisible(false);
569
- setSidePanel(SidePanelType.Participants);
570
- },
571
- });
572
- }
573
- if (!(defaultItemsConfig?.chat?.hide === 'yes')) {
574
- actionMenuitems.push({
575
- icon: 'chat-nav',
576
- iconColor: $config.SECONDARY_ACTION_COLOR,
577
- textColor: $config.FONT_COLOR,
578
- title: chatLabel,
579
- callback: () => {
580
- setActionMenuVisible(false);
581
- setChatType(ChatType.Group);
582
- setSidePanel(SidePanelType.Chat);
583
- },
584
- });
585
- }
533
+ actionMenuitems.push({
534
+ icon: 'play-circle',
535
+ iconColor: $config.SECONDARY_ACTION_COLOR,
536
+ textColor: $config.FONT_COLOR,
537
+ title: viewRecordingsLabel,
538
+ callback: () => {
539
+ toggleVRModal();
540
+ },
541
+ });
586
542
  }
587
543
 
588
544
  if (globalWidth <= BREAKPOINTS.sm) {
545
+ actionMenuitems.push({
546
+ icon: 'participants',
547
+ iconColor: $config.SECONDARY_ACTION_COLOR,
548
+ textColor: $config.FONT_COLOR,
549
+ title: peopleLabel,
550
+ callback: () => {
551
+ setActionMenuVisible(false);
552
+ setSidePanel(SidePanelType.Participants);
553
+ },
554
+ });
555
+ actionMenuitems.push({
556
+ icon: 'chat-nav',
557
+ iconColor: $config.SECONDARY_ACTION_COLOR,
558
+ textColor: $config.FONT_COLOR,
559
+ title: chatLabel,
560
+ callback: () => {
561
+ setActionMenuVisible(false);
562
+ setChatType(ChatType.Group);
563
+ setSidePanel(SidePanelType.Chat);
564
+ },
565
+ });
566
+
589
567
  if ($config.SCREEN_SHARING) {
590
568
  if (
591
569
  !(
@@ -594,112 +572,102 @@ const MoreButton = (props: {
594
572
  !$config.RAISE_HAND
595
573
  )
596
574
  ) {
597
- if (!(defaultItemsConfig?.screenshare?.hide === 'yes')) {
598
- actionMenuitems.push({
599
- disabled:
600
- rtcProps.role == ClientRoleType.ClientRoleAudience &&
601
- $config.EVENT_MODE &&
602
- $config.RAISE_HAND &&
603
- !isHost,
604
- icon: isScreenshareActive ? 'stop-screen-share' : 'screen-share',
605
- iconColor: isScreenshareActive
606
- ? $config.SEMANTIC_ERROR
607
- : $config.SECONDARY_ACTION_COLOR,
608
- textColor: isScreenshareActive
609
- ? $config.SEMANTIC_ERROR
610
- : $config.FONT_COLOR,
611
- title: screenShareButton(isScreenshareActive),
612
- callback: () => {
613
- setActionMenuVisible(false);
614
- isScreenshareActive ? stopScreenshare() : startScreenshare();
615
- },
616
- });
617
- }
618
- }
619
- }
620
- if (isHost && $config.CLOUD_RECORDING) {
621
- if (!(defaultItemsConfig?.recording?.hide === 'yes')) {
622
575
  actionMenuitems.push({
623
- disabled: inProgress,
624
- icon: isRecordingActive ? 'stop-recording' : 'recording',
625
- iconColor: isRecordingActive
576
+ disabled:
577
+ rtcProps.role == ClientRoleType.ClientRoleAudience &&
578
+ $config.EVENT_MODE &&
579
+ $config.RAISE_HAND &&
580
+ !isHost,
581
+ icon: isScreenshareActive ? 'stop-screen-share' : 'screen-share',
582
+ iconColor: isScreenshareActive
626
583
  ? $config.SEMANTIC_ERROR
627
584
  : $config.SECONDARY_ACTION_COLOR,
628
- textColor: isRecordingActive
585
+ textColor: isScreenshareActive
629
586
  ? $config.SEMANTIC_ERROR
630
587
  : $config.FONT_COLOR,
631
- title: recordingButton(isRecordingActive),
588
+ title: screenShareButton(isScreenshareActive),
632
589
  callback: () => {
633
590
  setActionMenuVisible(false);
634
- if (!isRecordingActive) {
635
- startRecording();
636
- } else {
637
- setShowStopRecordingPopup(true);
638
- }
591
+ isScreenshareActive ? stopScreenshare() : startScreenshare();
639
592
  },
640
593
  });
641
594
  }
642
595
  }
643
- }
644
-
645
- if (globalWidth <= BREAKPOINTS.lg) {
646
- if (!(defaultItemsConfig?.layout?.hide === 'yes')) {
647
- actionMenuitems.push({
648
- //below icon key is dummy value
649
- icon: 'grid',
650
- externalIconString: layouts[layout]?.icon,
651
- isExternalIcon: true,
652
- iconColor: $config.SECONDARY_ACTION_COLOR,
653
- textColor: $config.FONT_COLOR,
654
- title: layoutLabel,
655
- callback: () => {
656
- //setShowLayoutOption(true);
657
- },
658
- onHoverCallback: isHovered => {
659
- setShowLayoutOption(isHovered);
660
- },
661
- onHoverContent: (
662
- <LayoutIconDropdown
663
- onHoverPlaceHolder="vertical"
664
- setShowDropdown={() => {}}
665
- showDropdown={true}
666
- modalPosition={
667
- globalWidth <= BREAKPOINTS.lg
668
- ? {bottom: 65, left: -150}
669
- : {bottom: 20, left: -150}
670
- }
671
- caretPosition={{bottom: 45, right: -10}}
672
- />
673
- ),
674
- });
675
- }
676
- if (!(defaultItemsConfig?.invite?.hide === 'yes')) {
596
+ if (isHost && $config.CLOUD_RECORDING) {
677
597
  actionMenuitems.push({
678
- icon: 'share',
679
- iconColor: $config.SECONDARY_ACTION_COLOR,
680
- textColor: $config.FONT_COLOR,
681
- title: inviteLabel,
598
+ disabled: inProgress,
599
+ icon: isRecordingActive ? 'stop-recording' : 'recording',
600
+ iconColor: isRecordingActive
601
+ ? $config.SEMANTIC_ERROR
602
+ : $config.SECONDARY_ACTION_COLOR,
603
+ textColor: isRecordingActive
604
+ ? $config.SEMANTIC_ERROR
605
+ : $config.FONT_COLOR,
606
+ title: recordingButton(isRecordingActive),
682
607
  callback: () => {
683
608
  setActionMenuVisible(false);
684
- setShowInvitePopup(true);
609
+ if (!isRecordingActive) {
610
+ startRecording();
611
+ } else {
612
+ setShowStopRecordingPopup(true);
613
+ }
685
614
  },
686
615
  });
687
616
  }
688
617
  }
689
618
 
690
- if (globalWidth <= BREAKPOINTS.lg) {
691
- if (!(defaultItemsConfig?.settings?.hide === 'yes')) {
692
- actionMenuitems.push({
693
- icon: 'settings',
694
- iconColor: $config.SECONDARY_ACTION_COLOR,
695
- textColor: $config.FONT_COLOR,
696
- title: settingsLabel,
697
- callback: () => {
698
- setActionMenuVisible(false);
699
- setSidePanel(SidePanelType.Settings);
700
- },
701
- });
702
- }
619
+ if (globalWidth <= BREAKPOINTS.md) {
620
+ actionMenuitems.push({
621
+ //below icon key is dummy value
622
+ icon: 'grid',
623
+ externalIconString: layouts[layout]?.icon,
624
+ isExternalIcon: true,
625
+ iconColor: $config.SECONDARY_ACTION_COLOR,
626
+ textColor: $config.FONT_COLOR,
627
+ title: layoutLabel,
628
+ callback: () => {
629
+ //setShowLayoutOption(true);
630
+ },
631
+ onHoverCallback: isHovered => {
632
+ setShowLayoutOption(isHovered);
633
+ },
634
+ onHoverContent: (
635
+ <LayoutIconDropdown
636
+ onHoverPlaceHolder="vertical"
637
+ setShowDropdown={() => {}}
638
+ showDropdown={true}
639
+ modalPosition={
640
+ globalWidth <= BREAKPOINTS.sm
641
+ ? {bottom: 65, left: -150}
642
+ : {bottom: 20, left: -150}
643
+ }
644
+ caretPosition={{bottom: 45, right: -10}}
645
+ />
646
+ ),
647
+ });
648
+ actionMenuitems.push({
649
+ icon: 'share',
650
+ iconColor: $config.SECONDARY_ACTION_COLOR,
651
+ textColor: $config.FONT_COLOR,
652
+ title: inviteLabel,
653
+ callback: () => {
654
+ setActionMenuVisible(false);
655
+ setShowInvitePopup(true);
656
+ },
657
+ });
658
+ }
659
+
660
+ if (globalWidth <= BREAKPOINTS.sm) {
661
+ actionMenuitems.push({
662
+ icon: 'settings',
663
+ iconColor: $config.SECONDARY_ACTION_COLOR,
664
+ textColor: $config.FONT_COLOR,
665
+ title: settingsLabel,
666
+ callback: () => {
667
+ setActionMenuVisible(false);
668
+ setSidePanel(SidePanelType.Settings);
669
+ },
670
+ });
703
671
  }
704
672
 
705
673
  useEffect(() => {
@@ -910,9 +878,7 @@ export const RecordingToolbarItem = () => {
910
878
  );
911
879
  };
912
880
 
913
- export const MoreButtonToolbarItem = (props: {
914
- defaultItemsConfig: ToolbarBottomPresetProps['defaultItemsConfig'];
915
- }) => {
881
+ export const MoreButtonToolbarItem = () => {
916
882
  const {width} = useWindowDimensions();
917
883
  const {
918
884
  data: {isHost},
@@ -924,7 +890,7 @@ export const MoreButtonToolbarItem = (props: {
924
890
  forceUpdate();
925
891
  }, [isHost]);
926
892
 
927
- return width < BREAKPOINTS.lg ||
893
+ return width < BREAKPOINTS.md ||
928
894
  ($config.ENABLE_STT &&
929
895
  $config.ENABLE_CAPTION &&
930
896
  (isHost || (!isHost && isSTTActive))) ||
@@ -938,7 +904,7 @@ export const MoreButtonToolbarItem = (props: {
938
904
  ) : (
939
905
  <></>
940
906
  )}
941
- <MoreButton defaultItemsConfig={props?.defaultItemsConfig} />
907
+ <MoreButton />
942
908
  </ToolbarItem>
943
909
  ) : (
944
910
  <WhiteboardListener />
@@ -1180,12 +1146,7 @@ const Controls = (props: ControlsProps) => {
1180
1146
  return items?.map((item, index) => {
1181
1147
  const ToolbarItem = item?.component;
1182
1148
  if (ToolbarItem) {
1183
- return (
1184
- <ToolbarItem
1185
- key={`bottom-toolbar-${type}` + index}
1186
- defaultItemsConfig={defaultItemsConfig}
1187
- />
1188
- );
1149
+ return <ToolbarItem key={`bottom-toolbar-${type}` + index} />;
1189
1150
  } else {
1190
1151
  return null;
1191
1152
  }
@@ -1193,7 +1154,7 @@ const Controls = (props: ControlsProps) => {
1193
1154
  };
1194
1155
  return (
1195
1156
  <Toolbar>
1196
- {width >= BREAKPOINTS.lg && (
1157
+ {width >= BREAKPOINTS.md && (
1197
1158
  <View style={[style.startContent]}>
1198
1159
  {renderContent(customStartItems, 'start')}
1199
1160
  </View>
@@ -1201,7 +1162,7 @@ const Controls = (props: ControlsProps) => {
1201
1162
  <View style={[style.centerContent]}>
1202
1163
  {renderContent(customCenterItems, 'center')}
1203
1164
  </View>
1204
- {width >= BREAKPOINTS.lg && (
1165
+ {width >= BREAKPOINTS.md && (
1205
1166
  <View style={style.endContent}>
1206
1167
  {renderContent(customEndItems, 'end')}
1207
1168
  </View>
@@ -580,7 +580,7 @@ const Navbar = (props: NavbarProps) => {
580
580
  <View style={style.centerContent}>
581
581
  {renderContent(customCenterItems, 'center')}
582
582
  </View>
583
- {width > BREAKPOINTS.lg || isMobileUA() ? (
583
+ {width > BREAKPOINTS.sm || isMobileUA() ? (
584
584
  <View style={style.endContent}>
585
585
  {renderContent(customEndItems, 'end')}
586
586
  </View>
@@ -29,6 +29,7 @@ interface ChatMessageAttributes {
29
29
  file_name?: string;
30
30
  file_url?: string;
31
31
  from_platform?: string;
32
+ channel?: string;
32
33
  }
33
34
  interface chatConfigureContextInterface {
34
35
  open: boolean;
@@ -65,7 +66,7 @@ const ChatConfigure = ({children}) => {
65
66
  const chatClient = ChatClient.getInstance();
66
67
  const chatManager = chatClient.chatManager;
67
68
 
68
- const localUid = data?.channel + '_' + data?.uid?.toString();
69
+ const localUid = data?.uid?.toString();
69
70
  const agoraToken = data?.chat?.user_token;
70
71
  const {store} = React.useContext(StorageContext);
71
72
  const {
@@ -119,11 +120,14 @@ const ChatConfigure = ({children}) => {
119
120
  messages[0].chatType === ChatMessageChatType.PeerChat;
120
121
  const {msgId, from, body, localTime} = messages[0];
121
122
  const chatType = body.type;
122
- const fromUser = from.split('_')[1];
123
- const {file_ext, file_name, file_url, from_platform} = messages[0]
124
- .attributes as ChatMessageAttributes;
123
+ const fromUser = from;
124
+ const {file_ext, file_name, file_url, from_platform, channel} =
125
+ messages[0].attributes as ChatMessageAttributes;
125
126
 
126
- //@ts-ignore
127
+ // prevent cross channel msgs
128
+ if (channel !== data.channel) {
129
+ return;
130
+ }
127
131
 
128
132
  switch (chatType) {
129
133
  case ChatMessageType.TXT:
@@ -277,7 +281,7 @@ const ChatConfigure = ({children}) => {
277
281
  logger.log(
278
282
  LogSource.Internals,
279
283
  'CHAT',
280
- `Logged in User ${localUid} to Agora Chat Server`,
284
+ `Logged in Native User ${localUid} to Agora Chat Server`,
281
285
  );
282
286
  setupMessageListener();
283
287
  // adding chat connection event listeners
@@ -291,6 +295,11 @@ const ChatConfigure = ({children}) => {
291
295
  onConnected() {
292
296
  console.warn('onConnected');
293
297
  // once sdk connects to chat server successfully , need to add message listeners
298
+ logger.log(
299
+ LogSource.Internals,
300
+ 'CHAT',
301
+ `Native User ${localUid} to connected to Agora Chat Server`,
302
+ );
294
303
  },
295
304
  onDisconnected() {
296
305
  console.warn('onDisconnected:');
@@ -305,7 +314,7 @@ const ChatConfigure = ({children}) => {
305
314
  logger.error(
306
315
  LogSource.Internals,
307
316
  'CHAT',
308
- `Failed Looger User ${localUid} to Agora Chat Server`,
317
+ `Failed Logging Native User ${localUid} from Agora Chat Server`,
309
318
  error,
310
319
  );
311
320
  }
@@ -334,6 +343,9 @@ const ChatConfigure = ({children}) => {
334
343
  switch (type) {
335
344
  case ChatMessageType.TXT:
336
345
  chatMsg = ChatMessage.createTextMessage(to, msg, chatMsgChatType);
346
+ chatMsg.attributes = {
347
+ channel: data.channel,
348
+ };
337
349
  break;
338
350
  case ChatMessageType.IMAGE:
339
351
  chatMsg = ChatMessage.createImageMessage(to, url, chatMsgChatType);
@@ -343,6 +355,7 @@ const ChatConfigure = ({children}) => {
343
355
  file_name: option?.ext?.file_name,
344
356
  file_url: option?.ext?.file_url, // this local url , when upload util is available for native then will use it
345
357
  from_platform: 'native',
358
+ channel: data.channel,
346
359
  };
347
360
 
348
361
  console.warn('Image msg to be sent', chatMsg);
@@ -358,6 +371,7 @@ const ChatConfigure = ({children}) => {
358
371
  file_name: option?.ext?.file_name,
359
372
  file_url: option?.url, // this local url , when upload util is available for native then will use it
360
373
  from_platform: 'native',
374
+ channel: data.channel,
361
375
  };
362
376
  console.warn('File msg to be sent', chatMsg);
363
377
  break;
@@ -381,13 +395,9 @@ const ChatConfigure = ({children}) => {
381
395
 
382
396
  // this is local user messages
383
397
  if (option.chatType === SDKChatType.SINGLE_CHAT) {
384
- addMessageToPrivateStore(
385
- Number(option.to.split('_')[1]),
386
- messageData,
387
- true,
388
- );
398
+ addMessageToPrivateStore(Number(option.to), messageData, true);
389
399
  } else {
390
- addMessageToStore(Number(option.from.split('_')[1]), messageData);
400
+ addMessageToStore(Number(option.from), messageData);
391
401
  }
392
402
  }
393
403
  })
@@ -77,6 +77,8 @@ const ChatConfigure = ({children}) => {
77
77
  useEffect(() => {
78
78
  const initializeChatSDK = async () => {
79
79
  try {
80
+ // disable Chat SDK logs
81
+ AgoraChat.logger.disableAll();
80
82
  const CHAT_APP_KEY = `${$config.CHAT_ORG_NAME}#${$config.CHAT_APP_NAME}`;
81
83
  // Initializes the Web client.
82
84
  newConn = new AgoraChat.connection({
@@ -84,10 +86,10 @@ const ChatConfigure = ({children}) => {
84
86
  });
85
87
  // Logs into Agora Chat.
86
88
  const result = await newConn.open({
87
- user: data?.channel + '_' + data?.uid?.toString(),
89
+ user: data?.uid?.toString(),
88
90
  agoraToken: data.chat.user_token,
89
91
  });
90
- logger.debug(
92
+ logger.log(
91
93
  LogSource.Internals,
92
94
  'CHAT',
93
95
  `Logged in User ${data.uid} to Agora Chat Server`,
@@ -97,16 +99,29 @@ const ChatConfigure = ({children}) => {
97
99
  newConn.addEventHandler('connection&message', {
98
100
  // app is connected to chat server
99
101
  onConnected: () => {
100
- console.log('%cChatSDK: connected to chat server', 'color: blue');
102
+ logger.log(
103
+ LogSource.Internals,
104
+ 'CHAT',
105
+ `User ${data.uid} connected to Agora Chat Server`,
106
+ );
101
107
  },
102
108
 
103
109
  onFileMessage: message => {
110
+ if (message?.ext?.channel !== data?.channel) {
111
+ return;
112
+ }
113
+ logger.debug(
114
+ LogSource.Internals,
115
+ 'CHAT',
116
+ `Received File Message`,
117
+ message,
118
+ );
104
119
  const fileUrl =
105
120
  message.ext?.from_platform === 'native'
106
121
  ? message.url
107
122
  : message.ext.file_url;
108
123
 
109
- const fromUser = message?.from.split('_')[1];
124
+ const fromUser = message?.from;
110
125
 
111
126
  if (message.chatType === SDKChatType.GROUP_CHAT) {
112
127
  showMessageNotification(
@@ -151,12 +166,21 @@ const ChatConfigure = ({children}) => {
151
166
  }
152
167
  },
153
168
  onImageMessage: message => {
169
+ if (message?.ext?.channel !== data?.channel) {
170
+ return;
171
+ }
172
+ logger.debug(
173
+ LogSource.Internals,
174
+ 'CHAT',
175
+ `Received Img Message`,
176
+ message,
177
+ );
154
178
  const fileUrl =
155
179
  message.ext?.from_platform === 'native'
156
180
  ? message.url
157
181
  : message.ext.file_url;
158
182
 
159
- const fromUser = message?.from.split('_')[1];
183
+ const fromUser = message?.from;
160
184
 
161
185
  if (message.chatType === SDKChatType.GROUP_CHAT) {
162
186
  showMessageNotification(
@@ -203,14 +227,17 @@ const ChatConfigure = ({children}) => {
203
227
  },
204
228
  // text message is recieved
205
229
  onTextMessage: message => {
206
- console.log(
207
- '%cChatSDK: received msg: %s. from: %s',
208
- 'color: blue',
209
- JSON.stringify(message, null, 2),
210
- defaultContentRef.current[message.from]?.name,
230
+ if (message?.ext?.channel !== data?.channel) {
231
+ return;
232
+ }
233
+ logger.debug(
234
+ LogSource.Internals,
235
+ 'CHAT',
236
+ `Received Text Message`,
237
+ message,
211
238
  );
212
239
 
213
- const fromUser = message?.from.split('_')[1];
240
+ const fromUser = message?.from;
214
241
 
215
242
  if (message.chatType === SDKChatType.GROUP_CHAT) {
216
243
  // show to notifcation- group msg received
@@ -262,20 +289,14 @@ const ChatConfigure = ({children}) => {
262
289
  },
263
290
  // on token expired
264
291
  onTokenExpired: () => {
265
- console.log('%cChatSDK: token has expired', 'color: blue');
292
+ logger.log(LogSource.Internals, 'CHAT', 'ChatSDK Token expired');
266
293
  },
267
294
  onError: error => {
268
- console.log('%cChatSDK: error', 'color: blue', error);
295
+ logger.error(LogSource.Internals, 'CHAT', 'ChatSDK Error', error);
269
296
  },
270
297
  });
271
298
  connRef.current = newConn;
272
- logger.debug(LogSource.Internals, 'CHAT', 'Initialized Chat SDK');
273
299
  } catch (error) {
274
- console.log(
275
- '%cChatSDK: initialization error: %s',
276
- 'color: red',
277
- JSON.stringify(error, null, 2),
278
- );
279
300
  logger.error(
280
301
  LogSource.Internals,
281
302
  'CHAT',
@@ -289,7 +310,7 @@ const ChatConfigure = ({children}) => {
289
310
  initializeChatSDK();
290
311
  return () => {
291
312
  newConn.close();
292
- logger.debug(
313
+ logger.log(
293
314
  LogSource.Internals,
294
315
  'CHAT',
295
316
  `Logging out User ${data.uid} from Agora Chat Server`,
@@ -304,6 +325,9 @@ const ChatConfigure = ({children}) => {
304
325
  if (connRef.current) {
305
326
  //TODO thumb and url of actual image uploaded available in file upload complete
306
327
  const localFileUrl = option?.ext?.file_url || '';
328
+ //add channel name so to prevent cross channel message mixup when same user joins two diff channels
329
+ // this is filtered on msgRecived event
330
+ option.ext = {...option?.ext, channel: data?.channel};
307
331
  //@ts-ignore
308
332
  const msg = AgoraChat.message.create(option);
309
333
  connRef.current
@@ -331,13 +355,9 @@ const ChatConfigure = ({children}) => {
331
355
  //todo chattype as per natue type
332
356
  // this is local user messages
333
357
  if (option.chatType === SDKChatType.SINGLE_CHAT) {
334
- addMessageToPrivateStore(
335
- Number(option?.to.split('_')[1]),
336
- messageData,
337
- true,
338
- );
358
+ addMessageToPrivateStore(Number(option?.to), messageData, true);
339
359
  } else {
340
- addMessageToStore(Number(option?.from.split('_')[1]), messageData);
360
+ addMessageToStore(Number(option?.from), messageData);
341
361
  }
342
362
  })
343
363
  .catch(error => {
@@ -402,11 +422,9 @@ const ChatConfigure = ({children}) => {
402
422
  const CHAT_APP_KEY = `${$config.CHAT_ORG_NAME}#${$config.CHAT_APP_NAME}`;
403
423
  const uploadObj = {
404
424
  onFileUploadProgress: (data: ProgressEvent) => {
405
- console.log('Chat-SDK: upload inprogress', data);
406
425
  setUploadStatus(UploadStatus.IN_PROGRESS);
407
426
  },
408
427
  onFileUploadComplete: (data: any) => {
409
- console.log('Chat-SDK: upload success', data);
410
428
  const url = `${data.uri}/${data.entities[0].uuid}?em-redirect=true&share-secret=${data.entities[0]['share-secret']}`;
411
429
  //TODO: handle for multiple uploads
412
430
  setUploadedFiles(prev => {
@@ -415,7 +433,6 @@ const ChatConfigure = ({children}) => {
415
433
  setUploadStatus(UploadStatus.SUCCESS);
416
434
  },
417
435
  onFileUploadError: (error: any) => {
418
- console.log('Chat-SDK: upload error', error);
419
436
  logger.error(LogSource.Internals, 'CHAT', 'Attachment upload failed');
420
437
  setUploadStatus(UploadStatus.FAILURE);
421
438
  },
@@ -451,7 +468,12 @@ const ChatConfigure = ({children}) => {
451
468
  connRef.current
452
469
  .recallMessage(option)
453
470
  .then(res => {
454
- console.log('recall success', res);
471
+ logger.debug(
472
+ LogSource.Internals,
473
+ 'CHAT',
474
+ 'Chat Message Reacalled Success',
475
+ res,
476
+ );
455
477
  })
456
478
  .catch(err => {
457
479
  logger.debug(
@@ -490,12 +490,7 @@ const ActionSheetContent = props => {
490
490
  componentName: 'recording',
491
491
  component: isHost && $config.CLOUD_RECORDING ? <RecordingIcon /> : null,
492
492
  },
493
- ];
494
-
495
- if (
496
- !(defaultItemsConfig?.more?.fields?.['virtual-background']?.hide === 'yes')
497
- ) {
498
- defaultItems.push({
493
+ {
499
494
  default: true,
500
495
  order: 7,
501
496
  hide: 'no',
@@ -505,45 +500,42 @@ const ActionSheetContent = props => {
505
500
  $config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM ? (
506
501
  <VBIcon />
507
502
  ) : null,
508
- });
509
- }
510
- defaultItems.push({
511
- default: true,
512
- order: 8,
513
- hide: 'no',
514
- align: 'start',
515
- componentName: 'switch-camera',
516
- component:
517
- !isAudioRoom &&
518
- (isAudioVideoControlsDisabled ? null : <SwitchCameraIcon />),
519
- });
520
- defaultItems.push({
521
- default: true,
522
- order: 9,
523
- hide: 'no',
524
- align: 'start',
525
- componentName: 'layout',
526
- component: <LayoutIcon />,
527
- });
528
- defaultItems.push({
529
- default: true,
530
- order: 10,
531
- hide: 'no',
532
- align: 'start',
533
- componentName: 'settings',
534
- component: <SettingsIcon />,
535
- });
536
- defaultItems.push({
537
- default: true,
538
- order: 11,
539
- hide: 'no',
540
- align: 'start',
541
- componentName: 'invite',
542
- component: <ShareIcon />,
543
- });
544
-
545
- if (!(defaultItemsConfig?.more?.fields?.caption?.hide === 'yes')) {
546
- defaultItems.push({
503
+ },
504
+ {
505
+ default: true,
506
+ order: 8,
507
+ hide: 'no',
508
+ align: 'start',
509
+ componentName: 'switch-camera',
510
+ component:
511
+ !isAudioRoom &&
512
+ (isAudioVideoControlsDisabled ? null : <SwitchCameraIcon />),
513
+ },
514
+ {
515
+ default: true,
516
+ order: 9,
517
+ hide: 'no',
518
+ align: 'start',
519
+ componentName: 'layout',
520
+ component: <LayoutIcon />,
521
+ },
522
+ {
523
+ default: true,
524
+ order: 10,
525
+ hide: 'no',
526
+ align: 'start',
527
+ componentName: 'settings',
528
+ component: <SettingsIcon />,
529
+ },
530
+ {
531
+ default: true,
532
+ order: 11,
533
+ hide: 'no',
534
+ align: 'start',
535
+ componentName: 'invite',
536
+ component: <ShareIcon />,
537
+ },
538
+ {
547
539
  default: true,
548
540
  order: 12,
549
541
  hide: 'no',
@@ -554,18 +546,16 @@ const ActionSheetContent = props => {
554
546
  onPress={() => handleSheetChanges(isExpanded ? 0 : 1)}
555
547
  />
556
548
  ),
557
- });
558
- }
559
- if (!(defaultItemsConfig?.more?.fields?.transcript?.hide === 'yes')) {
560
- defaultItems.push({
549
+ },
550
+ {
561
551
  default: true,
562
552
  order: 13,
563
553
  hide: 'no',
564
554
  align: 'start',
565
555
  componentName: 'transcript',
566
556
  component: <TranscriptIconBtn />,
567
- });
568
- }
557
+ },
558
+ ];
569
559
 
570
560
  const isHidden = i => {
571
561
  return i?.hide === 'yes';
@@ -655,11 +645,13 @@ const CarouselWrapper = ({data}) => {
655
645
 
656
646
  const isPaginationRequired = slides.length > 1;
657
647
 
658
- return (
659
- <View style={{flexDirection: 'row'}}>
660
- <Carousel data={slides} isPaginationRequired={isPaginationRequired} />
661
- </View>
662
- );
648
+ if (isPaginationRequired)
649
+ return (
650
+ <View style={{flexDirection: 'row'}}>
651
+ <Carousel data={slides} />
652
+ </View>
653
+ );
654
+ return <View style={styles.row}>{slides[0].component}</View>;
663
655
  };
664
656
 
665
657
  export default ActionSheetContent;
@@ -150,10 +150,8 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
150
150
  ? SDKChatType.SINGLE_CHAT
151
151
  : SDKChatType.GROUP_CHAT,
152
152
  type: ChatMessageType.TXT,
153
- from: data.channel + '_' + data.uid.toString(),
154
- to: privateChatUser
155
- ? data.channel + '_' + privateChatUser.toString()
156
- : groupID,
153
+ from: data.uid.toString(),
154
+ to: privateChatUser ? privateChatUser.toString() : groupID,
157
155
  msg: message,
158
156
  };
159
157
  sendChatSDKMessage(option);
@@ -145,17 +145,13 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
145
145
  return;
146
146
  }
147
147
 
148
- debugger;
149
- console.log(data);
150
148
  const option = {
151
149
  chatType: privateChatUser
152
150
  ? SDKChatType.SINGLE_CHAT
153
151
  : SDKChatType.GROUP_CHAT,
154
152
  type: ChatMessageType.TXT,
155
- from: data.channel + '_' + data.uid.toString(),
156
- to: privateChatUser
157
- ? data.channel + '_' + privateChatUser.toString()
158
- : groupID,
153
+ from: data.uid.toString(),
154
+ to: privateChatUser ? privateChatUser.toString() : groupID,
159
155
  msg: message,
160
156
  };
161
157
  sendChatSDKMessage(option);
@@ -62,7 +62,7 @@ export const ChatActionMenu = (props: CaptionsActionMenuProps) => {
62
62
  const {defaultContent} = useContent();
63
63
 
64
64
  const {
65
- data: {isHost, chat, channel},
65
+ data: {isHost, chat},
66
66
  } = useRoomInfo();
67
67
 
68
68
  const groupID = chat.group_id;
@@ -167,13 +167,7 @@ export const ChatActionMenu = (props: CaptionsActionMenuProps) => {
167
167
  confirmLabel={confirmLabel}
168
168
  confirmLabelStyle={{color: $config.SEMANTIC_ERROR}}
169
169
  onConfirmClick={() => {
170
- deleteAttachment(
171
- msgId,
172
- privateChatUser
173
- ? channel + '_' + recallFromUser
174
- : recallFromUser.toString(),
175
- chatType,
176
- );
170
+ deleteAttachment(msgId, recallFromUser.toString(), chatType);
177
171
  if (chatType === SDKChatType.SINGLE_CHAT) {
178
172
  removeMessageFromPrivateStore(msgId, isLocal);
179
173
  }
@@ -128,13 +128,11 @@ export const ChatAttachmentButton = (props: ChatAttachmentButtonProps) => {
128
128
  const option = {
129
129
  type: isImageUploaded ? ChatMessageType.IMAGE : ChatMessageType.FILE,
130
130
  url: filePath,
131
- to: privateChatUser
132
- ? data.channel + '_' + privateChatUser.toString()
133
- : groupID,
131
+ to: privateChatUser ? privateChatUser.toString() : groupID,
134
132
  chatType: privateChatUser
135
133
  ? SDKChatType.SINGLE_CHAT
136
134
  : SDKChatType.GROUP_CHAT,
137
- from: data.channel + '_' + data.uid.toString(),
135
+ from: data.uid.toString(),
138
136
  fileName: result[0].name,
139
137
  ext: {
140
138
  file_length: result[0].size,
@@ -173,13 +171,9 @@ export const ChatAttachmentButton = (props: ChatAttachmentButtonProps) => {
173
171
 
174
172
  // this is local user messages
175
173
  if (message.chatType === ChatMessageChatType.PeerChat) {
176
- addMessageToPrivateStore(
177
- Number(message.to.split('_')[1]),
178
- messageData,
179
- true,
180
- );
174
+ addMessageToPrivateStore(Number(message.to), messageData, true);
181
175
  } else {
182
- addMessageToStore(Number(message.from.split('_')[1]), messageData);
176
+ addMessageToStore(Number(message.from), messageData);
183
177
  }
184
178
 
185
179
  setUploadStatus(UploadStatus.SUCCESS);
@@ -80,10 +80,8 @@ const ChatSendButton = (props: ChatSendButtonProps) => {
80
80
  : SDKChatType.GROUP_CHAT,
81
81
  type: msgType as ChatMessageType,
82
82
  msg: msgType === ChatMessageType.TXT ? message : '', // currenlt not supporting combinarion msg (file+txt)
83
- from: data.channel + '_' + data.uid.toString(),
84
- to: selectedUserId
85
- ? data.channel + '_' + selectedUserId.toString()
86
- : groupID,
83
+ from: data.uid.toString(),
84
+ to: selectedUserId ? selectedUserId.toString() : groupID,
87
85
  ext: {
88
86
  file_length,
89
87
  file_ext,
@@ -61,7 +61,7 @@ const ImagePopup = (props: ImagePopupProps) => {
61
61
  React.useState(false);
62
62
  const {privateChatUser} = useChatUIControls();
63
63
  const {
64
- data: {isHost, chat, channel},
64
+ data: {isHost, chat},
65
65
  } = useRoomInfo();
66
66
  const {downloadAttachment, deleteAttachment} = useChatConfigure();
67
67
  const {removeMessageFromPrivateStore, removeMessageFromStore} =
@@ -284,13 +284,7 @@ const ImagePopup = (props: ImagePopupProps) => {
284
284
  confirmLabel={confirmLabel}
285
285
  confirmLabelStyle={{color: $config.SEMANTIC_ERROR}}
286
286
  onConfirmClick={() => {
287
- deleteAttachment(
288
- msgId,
289
- privateChatUser
290
- ? channel + '_' + recallFromUser
291
- : recallFromUser.toString(),
292
- chatType,
293
- );
287
+ deleteAttachment(msgId, recallFromUser.toString(), chatType);
294
288
  if (chatType === SDKChatType.SINGLE_CHAT) {
295
289
  removeMessageFromPrivateStore(msgId, isLocal);
296
290
  }