agora-appbuilder-core 4.0.27 → 4.0.28-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 (83) hide show
  1. package/package.json +2 -2
  2. package/template/_package-lock.json +10 -7
  3. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +9 -0
  4. package/template/bridge/rtm/web/index.ts +44 -26
  5. package/template/customization-api/app-state.ts +1 -0
  6. package/template/customization-api/atoms.ts +8 -0
  7. package/template/customization-api/index.ts +1 -0
  8. package/template/customization-api/sub-components.ts +4 -1
  9. package/template/customization-api/temp.ts +1 -2
  10. package/template/customization-api/typeDefinition.ts +8 -0
  11. package/template/customization-api/types.ts +3 -0
  12. package/template/customization-api/utils.ts +10 -1
  13. package/template/defaultConfig.js +2 -2
  14. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +102 -50
  15. package/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/ScreenSharing.xcscheme +95 -0
  16. package/template/ios/Podfile +1 -1
  17. package/template/ios/Podfile.lock +200 -44
  18. package/template/ios/ScreenSharing/SampleHandler.h +2 -6
  19. package/template/ios/ScreenSharing/SampleHandler.m +17 -48
  20. package/template/package-lock.json +10 -7
  21. package/template/package.json +1 -1
  22. package/template/src/AppWrapper.tsx +2 -2
  23. package/template/src/assets/selection.json +3491 -1
  24. package/template/src/atoms/ActionMenu.tsx +96 -113
  25. package/template/src/atoms/LinkButton.tsx +4 -3
  26. package/template/src/atoms/ToolbarItem.tsx +36 -22
  27. package/template/src/atoms/ToolbarPreset.tsx +18 -3
  28. package/template/src/components/Controls.tsx +72 -49
  29. package/template/src/components/CustomSidePanel.tsx +82 -0
  30. package/template/src/components/EventsConfigure.tsx +11 -27
  31. package/template/src/components/Navbar.tsx +51 -86
  32. package/template/src/components/NavbarMobile.tsx +27 -3
  33. package/template/src/components/PinnedVideo.tsx +9 -0
  34. package/template/src/components/RTMConfigure.tsx +69 -1
  35. package/template/src/components/Settings.tsx +6 -29
  36. package/template/src/components/chat/chatConfigure.native.tsx +123 -119
  37. package/template/src/components/chat/chatConfigure.tsx +59 -46
  38. package/template/src/components/chat-messages/useChatMessages.tsx +5 -4
  39. package/template/src/components/chat-ui/useChatUIControls.tsx +4 -1
  40. package/template/src/components/livestream/views/LiveStreamControls.tsx +2 -1
  41. package/template/src/components/participants/UserActionMenuOptions.tsx +10 -10
  42. package/template/src/components/virtual-background/VBButton.tsx +5 -7
  43. package/template/src/language/default-labels/videoCallScreenLabels.ts +9 -2
  44. package/template/src/language/i18nTypes.ts +1 -1
  45. package/template/src/pages/video-call/ActionSheet.native.tsx +110 -34
  46. package/template/src/pages/video-call/ActionSheet.tsx +109 -27
  47. package/template/src/pages/video-call/ActionSheetContent.tsx +67 -49
  48. package/template/src/pages/video-call/ActionSheetHandle.tsx +12 -2
  49. package/template/src/pages/video-call/SidePanelHeader.tsx +28 -2
  50. package/template/src/pages/video-call/VideoCallScreen.tsx +70 -16
  51. package/template/src/pages/video-call/VideoRenderer.tsx +1 -0
  52. package/template/src/rtm-events-api/Events.ts +37 -3
  53. package/template/src/rtm-events-api/LocalEvents.ts +1 -0
  54. package/template/src/rtm-events-api/types.ts +5 -0
  55. package/template/src/subComponents/ChatBubble.tsx +15 -1
  56. package/template/src/subComponents/ChatInput.tsx +18 -7
  57. package/template/src/subComponents/CopyJoinInfo.tsx +5 -13
  58. package/template/src/subComponents/LayoutIconButton.tsx +6 -14
  59. package/template/src/subComponents/LocalAudioMute.tsx +7 -11
  60. package/template/src/subComponents/LocalEndCall.tsx +6 -4
  61. package/template/src/subComponents/LocalSwitchCamera.tsx +5 -4
  62. package/template/src/subComponents/LocalVideoMute.tsx +10 -36
  63. package/template/src/subComponents/Recording.tsx +4 -10
  64. package/template/src/subComponents/ScreenShareNotice.tsx +3 -0
  65. package/template/src/subComponents/SidePanelEnum.tsx +6 -6
  66. package/template/src/subComponents/caption/CaptionContainer.tsx +2 -2
  67. package/template/src/subComponents/caption/CaptionIcon.tsx +21 -17
  68. package/template/src/subComponents/caption/TranscriptIcon.tsx +6 -3
  69. package/template/src/subComponents/chat/ChatActionMenu.tsx +3 -3
  70. package/template/src/subComponents/chat/ChatAttachment.tsx +107 -51
  71. package/template/src/subComponents/chat/ChatEmoji.tsx +8 -4
  72. package/template/src/subComponents/chat/ChatSendButton.tsx +52 -30
  73. package/template/src/subComponents/chat/ChatUploadStatus.tsx +22 -3
  74. package/template/src/subComponents/chat/ImagePopup.tsx +4 -4
  75. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +14 -25
  76. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +8 -7
  77. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +333 -163
  78. package/template/src/utils/common.tsx +22 -9
  79. package/template/src/utils/useEndCall.ts +6 -4
  80. package/template/src/utils/useFullScreen.native.ts +12 -0
  81. package/template/src/utils/useOrientation.tsx +46 -46
  82. package/template/src/utils/useSidePanel.tsx +2 -2
  83. package/template/src/utils/useString.ts +6 -4
@@ -66,23 +66,22 @@ import {EventNames} from '../rtm-events';
66
66
  import events, {PersistanceLevel} from '../rtm-events-api';
67
67
  import Toast from '../../react-native-toast-message';
68
68
  import {getLanguageLabel} from '../../src/subComponents/caption/utils';
69
- import ImageIcon from '../atoms/ImageIcon';
70
- import useGetName from '../utils/useGetName';
71
69
  import Toolbar from '../atoms/Toolbar';
72
- import ToolbarItem from '../atoms/ToolbarItem';
70
+ import ToolbarItem, {useToolbarProps} from '../atoms/ToolbarItem';
73
71
  import {
74
- ToolbarBottomPresetProps,
72
+ ToolbarPresetProps,
75
73
  ToolbarItemHide,
76
- ToolbarMoreButtonFields,
74
+ ToolbarItemLabel,
75
+ ToolbarMoreButtonDefaultFields,
76
+ ToolbarMoreButtonCustomFields,
77
77
  } from '../atoms/ToolbarPreset';
78
78
 
79
- import {BoardColor, whiteboardContext} from './whiteboard/WhiteboardConfigure';
79
+ import {whiteboardContext} from './whiteboard/WhiteboardConfigure';
80
80
  import {RoomPhase} from 'white-web-sdk';
81
81
  import {useNoiseSupression} from '../app-state/useNoiseSupression';
82
82
 
83
83
  import {useVB} from './virtual-background/useVB';
84
84
  import WhiteboardWrapper from './whiteboard/WhiteboardWrapper';
85
- import isSDK from '../utils/isSDK';
86
85
  import LocalEventEmitter, {
87
86
  LocalEventsEnum,
88
87
  } from '../rtm-events-api/LocalEvents';
@@ -110,6 +109,7 @@ import {LogSource, logger} from '../logger/AppBuilderLogger';
110
109
  import {useModal} from '../utils/useModal';
111
110
  import ViewRecordingsModal from './recordings/ViewRecordingsModal';
112
111
  import {filterObject} from '../utils/index';
112
+ import {useLanguage} from '../language/useLanguage';
113
113
 
114
114
  export const useToggleWhiteboard = () => {
115
115
  const {
@@ -252,7 +252,8 @@ export const WhiteboardListener = () => {
252
252
  return null;
253
253
  };
254
254
 
255
- const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
255
+ const MoreButton = (props: {fields: ToolbarMoreButtonDefaultFields}) => {
256
+ const {label} = useToolbarProps();
256
257
  const noiseCancellationLabel = useString(toolbarItemNoiseCancellationText)();
257
258
  const whiteboardLabel = useString<boolean>(toolbarItemWhiteboardText);
258
259
  const captionLabel = useString<boolean>(toolbarItemCaptionText);
@@ -332,7 +333,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
332
333
  textColor: $config.FONT_COLOR,
333
334
  title: noiseCancellationLabel,
334
335
  //isNoiseSupressionEnabled === ToggleState.enabled
335
- callback: () => {
336
+ onPress: () => {
336
337
  setActionMenuVisible(false);
337
338
  setNoiseSupression(p => !p);
338
339
  },
@@ -362,7 +363,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
362
363
  textColor: $config.FONT_COLOR,
363
364
  //title: `${isVBActive ? 'Hide' : 'Show'} Virtual Background`,
364
365
  title: virtualBackgroundLabel,
365
- callback: () => {
366
+ onPress: () => {
366
367
  setActionMenuVisible(false);
367
368
  toggleVB();
368
369
  },
@@ -464,7 +465,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
464
465
  iconColor: $config.SECONDARY_ACTION_COLOR,
465
466
  textColor: $config.FONT_COLOR,
466
467
  title: whiteboardLabel(whiteboardActive),
467
- callback: () => {
468
+ onPress: () => {
468
469
  setActionMenuVisible(false);
469
470
  toggleWhiteboard(whiteboardActive, true);
470
471
  },
@@ -486,7 +487,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
486
487
  (isHost || (!isHost && isSTTActive))
487
488
  ),
488
489
  title: captionLabel(isCaptionON),
489
- callback: () => {
490
+ onPress: () => {
490
491
  setActionMenuVisible(false);
491
492
  STT_clicked.current = !isCaptionON ? 'caption' : null;
492
493
  if (isSTTError) {
@@ -517,7 +518,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
517
518
  (isHost || (!isHost && isSTTActive))
518
519
  ),
519
520
  title: transcriptLabel(isTranscriptON),
520
- callback: () => {
521
+ onPress: () => {
521
522
  setActionMenuVisible(false);
522
523
  STT_clicked.current = !isTranscriptON ? 'transcript' : null;
523
524
  if (isSTTError) {
@@ -549,7 +550,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
549
550
  iconColor: $config.SECONDARY_ACTION_COLOR,
550
551
  textColor: $config.FONT_COLOR,
551
552
  title: viewRecordingsLabel,
552
- callback: () => {
553
+ onPress: () => {
553
554
  toggleVRModal();
554
555
  },
555
556
  });
@@ -565,7 +566,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
565
566
  iconColor: $config.SECONDARY_ACTION_COLOR,
566
567
  textColor: $config.FONT_COLOR,
567
568
  title: peopleLabel,
568
- callback: () => {
569
+ onPress: () => {
569
570
  setActionMenuVisible(false);
570
571
  setSidePanel(SidePanelType.Participants);
571
572
  },
@@ -581,7 +582,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
581
582
  iconColor: $config.SECONDARY_ACTION_COLOR,
582
583
  textColor: $config.FONT_COLOR,
583
584
  title: chatLabel,
584
- callback: () => {
585
+ onPress: () => {
585
586
  setActionMenuVisible(false);
586
587
  setChatType(ChatType.Group);
587
588
  setSidePanel(SidePanelType.Chat);
@@ -615,7 +616,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
615
616
  ? $config.SEMANTIC_ERROR
616
617
  : $config.FONT_COLOR,
617
618
  title: screenShareButton(isScreenshareActive),
618
- callback: () => {
619
+ onPress: () => {
619
620
  setActionMenuVisible(false);
620
621
  isScreenshareActive ? stopScreenshare() : startScreenshare();
621
622
  },
@@ -638,7 +639,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
638
639
  ? $config.SEMANTIC_ERROR
639
640
  : $config.FONT_COLOR,
640
641
  title: recordingButton(isRecordingActive),
641
- callback: () => {
642
+ onPress: () => {
642
643
  setActionMenuVisible(false);
643
644
  if (!isRecordingActive) {
644
645
  startRecording();
@@ -662,7 +663,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
662
663
  iconColor: $config.SECONDARY_ACTION_COLOR,
663
664
  textColor: $config.FONT_COLOR,
664
665
  title: layoutLabel,
665
- callback: () => {
666
+ onPress: () => {
666
667
  //setShowLayoutOption(true);
667
668
  },
668
669
  onHoverCallback: isHovered => {
@@ -693,7 +694,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
693
694
  iconColor: $config.SECONDARY_ACTION_COLOR,
694
695
  textColor: $config.FONT_COLOR,
695
696
  title: inviteLabel,
696
- callback: () => {
697
+ onPress: () => {
697
698
  setActionMenuVisible(false);
698
699
  setShowInvitePopup(true);
699
700
  },
@@ -709,7 +710,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
709
710
  iconColor: $config.SECONDARY_ACTION_COLOR,
710
711
  textColor: $config.FONT_COLOR,
711
712
  title: settingsLabel,
712
- callback: () => {
713
+ onPress: () => {
713
714
  setActionMenuVisible(false);
714
715
  setSidePanel(SidePanelType.Settings);
715
716
  },
@@ -840,7 +841,7 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
840
841
  tintColor: $config.SECONDARY_ACTION_COLOR,
841
842
  }}
842
843
  btnTextProps={{
843
- text: $config.ICON_TEXT ? moreButtonLabel : '',
844
+ text: $config.ICON_TEXT ? label || moreButtonLabel : '',
844
845
  textColor: $config.FONT_COLOR,
845
846
  }}
846
847
  />
@@ -848,8 +849,8 @@ const MoreButton = (props: {fields: ToolbarMoreButtonFields}) => {
848
849
  </>
849
850
  );
850
851
  };
851
- export const LayoutToolbarItem = () => (
852
- <ToolbarItem testID="layout-btn" collapsable={false}>
852
+ export const LayoutToolbarItem = props => (
853
+ <ToolbarItem testID="layout-btn" collapsable={false} toolbarProps={props}>
853
854
  {/**
854
855
  * .measure returns undefined on Android unless collapsable=false or onLayout are specified
855
856
  * so added collapsable property
@@ -858,15 +859,15 @@ export const LayoutToolbarItem = () => (
858
859
  <LayoutIconButton />
859
860
  </ToolbarItem>
860
861
  );
861
- export const InviteToolbarItem = () => {
862
+ export const InviteToolbarItem = props => {
862
863
  return (
863
- <ToolbarItem testID="invite-btn">
864
+ <ToolbarItem testID="invite-btn" toolbarProps={props}>
864
865
  <CopyJoinInfo />
865
866
  </ToolbarItem>
866
867
  );
867
868
  };
868
869
 
869
- export const RaiseHandToolbarItem = () => {
870
+ export const RaiseHandToolbarItem = props => {
870
871
  const {rtcProps} = useContext(PropsContext);
871
872
  // attendee can view option if any host has started STT
872
873
  const {
@@ -874,14 +875,14 @@ export const RaiseHandToolbarItem = () => {
874
875
  } = useRoomInfo();
875
876
  return $config.EVENT_MODE ? (
876
877
  rtcProps.role == ClientRoleType.ClientRoleAudience ? (
877
- <LiveStreamControls showControls={true} />
878
+ <LiveStreamControls showControls={true} customProps={props} />
878
879
  ) : rtcProps?.role == ClientRoleType.ClientRoleBroadcaster ? (
879
880
  /**
880
881
  * In event mode when raise hand feature is active
881
882
  * and audience is promoted to host, the audience can also
882
883
  * demote himself
883
884
  */
884
- <LiveStreamControls showControls={!isHost} />
885
+ <LiveStreamControls showControls={!isHost} customProps={props} />
885
886
  ) : (
886
887
  <></>
887
888
  )
@@ -890,53 +891,53 @@ export const RaiseHandToolbarItem = () => {
890
891
  );
891
892
  };
892
893
 
893
- export const LocalAudioToolbarItem = () => {
894
+ export const LocalAudioToolbarItem = props => {
894
895
  return (
895
- <ToolbarItem testID="localAudio-btn">
896
+ <ToolbarItem testID="localAudio-btn" toolbarProps={props}>
896
897
  <LocalAudioMute showToolTip={true} />
897
898
  </ToolbarItem>
898
899
  );
899
900
  };
900
901
 
901
- export const LocalVideoToolbarItem = () => {
902
+ export const LocalVideoToolbarItem = props => {
902
903
  return (
903
904
  !$config.AUDIO_ROOM && (
904
- <ToolbarItem testID="localVideo-btn">
905
+ <ToolbarItem testID="localVideo-btn" toolbarProps={props}>
905
906
  <LocalVideoMute showToolTip={true} />
906
907
  </ToolbarItem>
907
908
  )
908
909
  );
909
910
  };
910
911
 
911
- export const SwitchCameraToolbarItem = () => {
912
+ export const SwitchCameraToolbarItem = props => {
912
913
  return (
913
914
  !$config.AUDIO_ROOM &&
914
915
  isMobileOrTablet() && (
915
- <ToolbarItem testID="switchCamera-btn">
916
+ <ToolbarItem testID="switchCamera-btn" toolbarProps={props}>
916
917
  <LocalSwitchCamera />
917
918
  </ToolbarItem>
918
919
  )
919
920
  );
920
921
  };
921
922
 
922
- export const ScreenShareToolbarItem = () => {
923
+ export const ScreenShareToolbarItem = props => {
923
924
  return (
924
925
  $config.SCREEN_SHARING &&
925
926
  !isMobileOrTablet() && (
926
- <ToolbarItem testID="screenShare-btn">
927
+ <ToolbarItem testID="screenShare-btn" toolbarProps={props}>
927
928
  <ScreenshareButton />
928
929
  </ToolbarItem>
929
930
  )
930
931
  );
931
932
  };
932
- export const RecordingToolbarItem = () => {
933
+ export const RecordingToolbarItem = props => {
933
934
  const {
934
935
  data: {isHost},
935
936
  } = useRoomInfo();
936
937
  return (
937
938
  isHost &&
938
939
  $config.CLOUD_RECORDING && (
939
- <ToolbarItem testID="recording-btn">
940
+ <ToolbarItem testID="recording-btn" toolbarProps={props}>
940
941
  <Recording />
941
942
  </ToolbarItem>
942
943
  )
@@ -944,7 +945,7 @@ export const RecordingToolbarItem = () => {
944
945
  };
945
946
 
946
947
  export const MoreButtonToolbarItem = (props?: {
947
- fields?: ToolbarMoreButtonFields;
948
+ fields?: ToolbarMoreButtonCustomFields;
948
949
  }) => {
949
950
  const {width} = useWindowDimensions();
950
951
  const {
@@ -965,7 +966,7 @@ export const MoreButtonToolbarItem = (props?: {
965
966
  (isHost && $config.CLOUD_RECORDING && isWeb()) ||
966
967
  ($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) ||
967
968
  (isHost && $config.ENABLE_WHITEBOARD && isWebInternal()) ? (
968
- <ToolbarItem testID="more-btn">
969
+ <ToolbarItem testID="more-btn" toolbarProps={props}>
969
970
  {!isHost && $config.ENABLE_WHITEBOARD && isWebInternal() ? (
970
971
  <WhiteboardListener />
971
972
  ) : (
@@ -985,13 +986,14 @@ export const LocalEndcallToolbarItem = (
985
986
  ) => {
986
987
  return (
987
988
  <ToolbarItem
988
- testID={props?.customExit ? 'endCall-btn-custom' : 'endCall-btn'}>
989
+ testID={props?.customExit ? 'endCall-btn-custom' : 'endCall-btn'}
990
+ toolbarProps={props}>
989
991
  <LocalEndcall {...props} />
990
992
  </ToolbarItem>
991
993
  );
992
994
  };
993
995
 
994
- const defaultItems: ToolbarBottomPresetProps['items'] = {
996
+ const defaultItems: ToolbarPresetProps['items'] = {
995
997
  layout: {
996
998
  align: 'start',
997
999
  component: LayoutToolbarItem,
@@ -1057,10 +1059,11 @@ const defaultItems: ToolbarBottomPresetProps['items'] = {
1057
1059
  };
1058
1060
 
1059
1061
  export interface ControlsProps {
1060
- items?: ToolbarBottomPresetProps['items'];
1062
+ items?: ToolbarPresetProps['items'];
1061
1063
  includeDefaultItems?: boolean;
1062
1064
  }
1063
1065
  const Controls = (props: ControlsProps) => {
1066
+ const {languageCode} = useLanguage();
1064
1067
  const {items = {}, includeDefaultItems = true} = props;
1065
1068
  const {width, height} = useWindowDimensions();
1066
1069
  const {defaultContent} = useContent();
@@ -1188,6 +1191,16 @@ const Controls = (props: ControlsProps) => {
1188
1191
  const centerItemsOrdered = CustomToolbarSorting(centerItems);
1189
1192
  const endItemsOrdered = CustomToolbarSorting(endItems);
1190
1193
 
1194
+ const customLabel = (labelParam: ToolbarItemLabel) => {
1195
+ if (labelParam && typeof labelParam === 'string') {
1196
+ return labelParam;
1197
+ } else if (labelParam && typeof labelParam === 'function') {
1198
+ return labelParam(languageCode);
1199
+ } else {
1200
+ return null;
1201
+ }
1202
+ };
1203
+
1191
1204
  const renderContent = (
1192
1205
  orderedKeys: string[],
1193
1206
  type: 'start' | 'center' | 'end',
@@ -1197,28 +1210,38 @@ const Controls = (props: ControlsProps) => {
1197
1210
  orderedKeys.forEach(keyName => {
1198
1211
  index = index + 1;
1199
1212
  let ToolbarComponent = null;
1200
- let ToolbarComponentProps = {};
1213
+ let label = null;
1214
+ let onPress = null;
1215
+ let fieldsProps = null;
1201
1216
  if (type === 'start') {
1202
1217
  ToolbarComponent = startItems[keyName]?.component;
1218
+ label = startItems[keyName]?.label;
1219
+ onPress = startItems[keyName]?.onPress;
1203
1220
  if (keyName === 'more') {
1204
- ToolbarComponentProps = startItems[keyName]?.fields;
1221
+ fieldsProps = startItems[keyName]?.fields;
1205
1222
  }
1206
1223
  } else if (type === 'center') {
1207
1224
  ToolbarComponent = centerItems[keyName]?.component;
1225
+ label = centerItems[keyName]?.label;
1226
+ onPress = centerItems[keyName]?.onPress;
1208
1227
  if (keyName === 'more') {
1209
- ToolbarComponentProps = centerItems[keyName]?.fields;
1228
+ fieldsProps = centerItems[keyName]?.fields;
1210
1229
  }
1211
1230
  } else {
1212
1231
  ToolbarComponent = endItems[keyName]?.component;
1232
+ label = endItems[keyName]?.label;
1233
+ onPress = endItems[keyName]?.onPress;
1213
1234
  if (keyName === 'more') {
1214
- ToolbarComponentProps = endItems[keyName]?.fields;
1235
+ fieldsProps = endItems[keyName]?.fields;
1215
1236
  }
1216
1237
  }
1217
1238
  if (ToolbarComponent) {
1218
1239
  renderContentItem.push(
1219
1240
  <ToolbarComponent
1220
1241
  key={`top-toolbar-${type}` + index}
1221
- fields={ToolbarComponentProps}
1242
+ fields={fieldsProps}
1243
+ label={customLabel(label)}
1244
+ onPress={onPress}
1222
1245
  />,
1223
1246
  );
1224
1247
  }
@@ -0,0 +1,82 @@
1
+ /*
2
+ ********************************************
3
+ Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
+ AppBuilder and all associated components, source code, APIs, services, and documentation
5
+ (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
+ accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
+ Use without a license or in violation of any license terms and conditions (including use for
8
+ any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
+ information visit https://appbuilder.agora.io.
10
+ *********************************************
11
+ */
12
+ import React from 'react';
13
+ import {View, Text, StyleSheet, ScrollView} from 'react-native';
14
+ import {isMobileUA, isWebInternal, useIsSmall} from '../utils/common';
15
+ import CommonStyles from './CommonStyles';
16
+ import SidePanelHeader, {
17
+ SidePanelStyles,
18
+ } from '../subComponents/SidePanelHeader';
19
+ import {useLayout} from '../utils/useLayout';
20
+ import {getGridLayoutName} from '../pages/video-call/DefaultLayouts';
21
+ import useCaptionWidth from '../subComponents/caption/useCaptionWidth';
22
+ import {useSidePanel} from '../utils/useSidePanel';
23
+ import {SidePanelType} from '../subComponents/SidePanelEnum';
24
+ import {CustomSidePanelHeader} from '../pages/video-call/SidePanelHeader';
25
+
26
+ export interface CustomSidePanelViewInterface {
27
+ name: string;
28
+ title?: string;
29
+ content: React.ComponentType;
30
+ onClose?: () => void;
31
+ showHeader?: boolean;
32
+ }
33
+
34
+ const CustomSidePanelView = (props: CustomSidePanelViewInterface) => {
35
+ const {
36
+ content: CustomSidePanelContent,
37
+ showHeader = true,
38
+ name,
39
+ title,
40
+ onClose,
41
+ } = props;
42
+ const {currentLayout} = useLayout();
43
+ const {transcriptHeight} = useCaptionWidth();
44
+ const {setSidePanel} = useSidePanel();
45
+ const isSmall = useIsSmall();
46
+
47
+ return (
48
+ <View
49
+ testID="custom-side-panel"
50
+ style={[
51
+ isMobileUA()
52
+ ? //mobile and mobile web
53
+ CommonStyles.sidePanelContainerNative
54
+ : isSmall()
55
+ ? // desktop minimized
56
+ CommonStyles.sidePanelContainerWebMinimzed
57
+ : // desktop maximized
58
+ CommonStyles.sidePanelContainerWeb,
59
+ isWebInternal() && !isSmall() && currentLayout === getGridLayoutName()
60
+ ? {marginVertical: 4}
61
+ : {},
62
+ //@ts-ignore
63
+ transcriptHeight && !isMobileUA() && {height: transcriptHeight},
64
+ ]}>
65
+ {showHeader && (
66
+ <CustomSidePanelHeader name={name} title={title} onClose={onClose} />
67
+ )}
68
+ <ScrollView style={[style.bodyContainer]}>
69
+ {CustomSidePanelContent ? <CustomSidePanelContent /> : <></>}
70
+ </ScrollView>
71
+ </View>
72
+ );
73
+ };
74
+
75
+ const style = StyleSheet.create({
76
+ bodyContainer: {
77
+ flex: 1,
78
+ padding: 20,
79
+ },
80
+ });
81
+
82
+ export default CustomSidePanelView;
@@ -221,18 +221,12 @@ const EventsConfigure: React.FC<Props> = props => {
221
221
  waitingRoomApprovalRequiredSecondaryBtnTextTT;
222
222
  }, [waitingRoomApprovalRequiredSecondaryBtnTextTT]);
223
223
 
224
- //@ts-ignore
225
- const {isScreenshareActive, ScreenshareStoppedCallback, stopScreenshare} =
226
- useScreenshare();
227
224
  const isLiveStream = $config.EVENT_MODE;
228
225
  const {dispatch} = useContext(DispatchContext);
229
226
  const {RtcEngineUnsafe} = useContext(RtcContext);
230
227
  const {defaultContent, activeUids} = useContent();
231
228
  const defaultContentRef = useRef({defaultContent});
232
- const isScreenshareActiveRef = useRef({isScreenshareActive});
233
- useEffect(() => {
234
- isScreenshareActiveRef.current.isScreenshareActive = isScreenshareActive;
235
- }, [isScreenshareActive]);
229
+
236
230
  useEffect(() => {
237
231
  defaultContentRef.current.defaultContent = defaultContent;
238
232
  }, [defaultContent]);
@@ -288,23 +282,15 @@ const EventsConfigure: React.FC<Props> = props => {
288
282
  secondaryBtn: null,
289
283
  leadingIcon: null,
290
284
  });
291
- if (
292
- (isAndroid() || isIOS()) &&
293
- isScreenshareActiveRef.current.isScreenshareActive
294
- ) {
295
- //@ts-ignore
296
- stopScreenshare(false, true);
297
- } else {
298
- isWebInternal()
299
- ? await RtcEngineUnsafe.muteLocalVideoStream(true)
300
- : //@ts-ignore
301
- await RtcEngineUnsafe.enableLocalVideo(false);
302
- await updateVideoStream(true);
303
- dispatch({
304
- type: 'LocalMuteVideo',
305
- value: [0],
306
- });
307
- }
285
+ isWebInternal()
286
+ ? await RtcEngineUnsafe.muteLocalVideoStream(true)
287
+ : //@ts-ignore
288
+ await RtcEngineUnsafe.enableLocalVideo(false);
289
+ await updateVideoStream(true);
290
+ dispatch({
291
+ type: 'LocalMuteVideo',
292
+ value: [0],
293
+ });
308
294
  });
309
295
  events.on(controlMessageEnum.muteAudio, async ({sender}) => {
310
296
  Toast.show({
@@ -332,9 +318,7 @@ const EventsConfigure: React.FC<Props> = props => {
332
318
  //before kickoff the user we have check whether screenshare on/off
333
319
  //if its on then stop screenshare and emit event for screensharing is stopped
334
320
  try {
335
- if (isScreenshareActiveRef?.current?.isScreenshareActive) {
336
- ScreenshareStoppedCallback && ScreenshareStoppedCallback();
337
- }
321
+ LocalEventEmitter.emit(LocalEventsEnum.USER_KICKED_OFF_BY_REMOTE_HOST);
338
322
  } catch (error) {
339
323
  console.log('error on stop the screeshare', error);
340
324
  }