agora-appbuilder-core 4.0.32 → 4.0.33-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.
@@ -152,4 +152,5 @@ export interface IconsInterface {
152
152
  'recording-status': string;
153
153
  fullscreen: string;
154
154
  add_reaction: string;
155
+ spotlight: string;
155
156
  }
@@ -42,6 +42,7 @@ import {
42
42
  useLayout,
43
43
  useContent,
44
44
  useSidePanel,
45
+ useSpotlight,
45
46
  } from 'customization-api';
46
47
  import {getPinnedLayoutName} from '../../pages/video-call/DefaultLayouts';
47
48
  import UserActionMenuOptionsOptions from './UserActionMenuOptions';
@@ -96,6 +97,7 @@ const Participant = (props: ParticipantInterface) => {
96
97
  const showModal = () => {
97
98
  setActionMenuVisible(state => !state);
98
99
  };
100
+ const {setSpotlightUid, spotlightUid} = useSpotlight();
99
101
 
100
102
  return (
101
103
  <>
@@ -105,6 +107,8 @@ const Participant = (props: ParticipantInterface) => {
105
107
  user={props.user}
106
108
  btnRef={moreIconRef}
107
109
  from={'partcipant'}
110
+ spotlightUid={spotlightUid}
111
+ setSpotlightUid={setSpotlightUid}
108
112
  />
109
113
  <PlatformWrapper showModal={showModal} setIsHovered={setIsHovered}>
110
114
  <View style={styles.container} ref={usercontainerRef}>
@@ -57,6 +57,7 @@ import {
57
57
  moreBtnRemoveFromRoom,
58
58
  moreBtnRemoveFromTop,
59
59
  moreBtnRemoveScreenShare,
60
+ moreBtnSpotlight,
60
61
  moreBtnStopScreenShare,
61
62
  moreBtnVideo,
62
63
  moreBtnViewInLarge,
@@ -64,6 +65,7 @@ import {
64
65
  userRemovedFromTheRoomToastHeading,
65
66
  } from '../../language/default-labels/videoCallScreenLabels';
66
67
  import {isAndroid, isIOS} from '../../utils/common';
68
+ import {EventNames} from '../../rtm-events';
67
69
 
68
70
  interface UserActionMenuOptionsOptionsProps {
69
71
  user: ContentInterface;
@@ -71,6 +73,8 @@ interface UserActionMenuOptionsOptionsProps {
71
73
  setActionMenuVisible: (actionMenuVisible: boolean) => void;
72
74
  btnRef: any;
73
75
  from: 'partcipant' | 'screenshare-participant' | 'video-tile';
76
+ spotlightUid?: UidType;
77
+ setSpotlightUid?: (uid: UidType) => void;
74
78
  }
75
79
  export default function UserActionMenuOptionsOptions(
76
80
  props: UserActionMenuOptionsOptionsProps,
@@ -85,7 +89,7 @@ export default function UserActionMenuOptionsOptions(
85
89
  useState(false);
86
90
  const [actionMenuitems, setActionMenuitems] = useState<ActionMenuItem[]>([]);
87
91
  const {setSidePanel} = useSidePanel();
88
- const {user, actionMenuVisible, setActionMenuVisible} = props;
92
+ const {user, actionMenuVisible, setActionMenuVisible, spotlightUid} = props;
89
93
  const {currentLayout} = useLayout();
90
94
  const {pinnedUid, activeUids, customContent, secondaryPinnedUid} =
91
95
  useContent();
@@ -122,6 +126,7 @@ export default function UserActionMenuOptionsOptions(
122
126
  const stopScreenShareLabel = useString(moreBtnStopScreenShare)();
123
127
  const removeScreenShareLabel = useString(moreBtnRemoveScreenShare)();
124
128
  const removeFromRoomLabel = useString(moreBtnRemoveFromRoom)();
129
+ const moreBtnSpotlightLabel = useString(moreBtnSpotlight);
125
130
 
126
131
  useEffect(() => {
127
132
  customEvents.on('DisableChat', data => {
@@ -212,6 +217,33 @@ export default function UserActionMenuOptionsOptions(
212
217
  }
213
218
  }
214
219
 
220
+ if ($config.ENABLE_SPOTLIGHT && isHost && user.type === 'rtc') {
221
+ items.push({
222
+ icon: 'spotlight',
223
+ title: moreBtnSpotlightLabel(user.uid == props?.spotlightUid),
224
+ iconColor: $config.SECONDARY_ACTION_COLOR,
225
+ textColor: $config.SECONDARY_ACTION_COLOR,
226
+ onPress: () => {
227
+ if (user.uid == props?.spotlightUid) {
228
+ props?.setSpotlightUid(0);
229
+ events.send(
230
+ EventNames.SPOTLIGHT_USER_CHANGED,
231
+ JSON.stringify({user_id: 0}),
232
+ PersistanceLevel.Session,
233
+ );
234
+ } else {
235
+ props?.setSpotlightUid(user.uid);
236
+ events.send(
237
+ EventNames.SPOTLIGHT_USER_CHANGED,
238
+ JSON.stringify({user_id: user.uid}),
239
+ PersistanceLevel.Session,
240
+ );
241
+ }
242
+ setActionMenuVisible(false);
243
+ },
244
+ });
245
+ }
246
+
215
247
  /**
216
248
  * Below menu items for remote user with type rtc(not for screenshare)
217
249
  */
@@ -399,6 +431,7 @@ export default function UserActionMenuOptionsOptions(
399
431
  disableChatUids,
400
432
  secondaryPinnedUid,
401
433
  currentLayout,
434
+ spotlightUid,
402
435
  ]);
403
436
 
404
437
  const {width: globalWidth, height: globalHeight} = useWindowDimensions();
@@ -267,6 +267,7 @@ export const moreBtnRemoveFromLarge = 'moreBtnRemoveFromLarge';
267
267
  export const moreBtnPinToTop = 'moreBtnPinToTop';
268
268
  export const moreBtnRemoveFromTop = 'moreBtnRemoveFromTop';
269
269
  export const moreBtnMessagePrivately = 'moreBtnMessagePrivately';
270
+ export const moreBtnSpotlight = 'moreBtnSpotlight';
270
271
 
271
272
  export const moreBtnAudio = 'moreBtnAudio';
272
273
  export const moreBtnVideo = 'moreBtnVideo';
@@ -380,6 +381,8 @@ export const livestreamPromoteAsCoHostToastHeading =
380
381
  export const livestreamRequestAlreadyProcessed =
381
382
  'livestreamRequestAlreadyProcessed';
382
383
 
384
+ export const videoRoomInTheSpotlightText =
385
+ `video${room}InTheSpotlightText` as const;
383
386
  export const videoRoomUserFallbackText =
384
387
  `video${room}UserFallbackText` as const;
385
388
 
@@ -682,6 +685,8 @@ export interface I18nVideoCallScreenLabelsInterface {
682
685
  [moreBtnChangeName]?: I18nBaseType;
683
686
  [moreBtnStopScreenShare]?: I18nBaseType;
684
687
  [moreBtnRemoveScreenShare]?: I18nBaseType;
688
+ [moreBtnSpotlight]?: I18nConditionalType;
689
+ [videoRoomInTheSpotlightText]?: I18nBaseType;
685
690
 
686
691
  [muteAllConfirmationPopoverContent]?: I18nBaseType<I18nMuteType>;
687
692
  [muteAllConfirmationPopoverPrimaryBtnText]?: I18nBaseType;
@@ -1080,6 +1085,9 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
1080
1085
  [moreBtnChangeName]: 'Change Name',
1081
1086
  [moreBtnStopScreenShare]: 'Stop Screenshare',
1082
1087
  [moreBtnRemoveScreenShare]: 'Remove Screenshare',
1088
+ [moreBtnSpotlight]: spotlightOn =>
1089
+ spotlightOn ? 'Remove Spotlight' : 'Spotlight',
1090
+ [videoRoomInTheSpotlightText]: 'In the Spotlight',
1083
1091
 
1084
1092
  [muteAllConfirmationPopoverContent]: (type: I18nMuteType) =>
1085
1093
  `Mute everyone's ${type} on the call?`,
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import {View, StyleSheet, Text} from 'react-native';
3
+ import ThemeConfig from '../../theme';
4
+ import ImageIcon from '../../atoms/ImageIcon';
5
+ import {useLayout, useContent} from 'customization-api';
6
+ import {isMobileUA, isWeb} from '../../utils/common';
7
+ import {getGridLayoutName} from './DefaultLayouts';
8
+ import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
9
+ import {useString} from '../../utils/useString';
10
+
11
+ const SpotlightHighligher = () => {
12
+ const {activeUids, customContent} = useContent();
13
+ const {currentLayout} = useLayout();
14
+ const activeUidsLen = activeUids?.filter(i => !customContent[i])?.length;
15
+ const reduceSpace =
16
+ isMobileUA() &&
17
+ activeUids.length > 4 &&
18
+ currentLayout === getGridLayoutName();
19
+ const spotlightText = useString('videoRoomInTheSpotlightText')();
20
+
21
+ return (
22
+ <View
23
+ style={[
24
+ style.container,
25
+ reduceSpace ? {left: 2, bottom: 2} : {},
26
+ reduceSpace && activeUidsLen > 12 ? {padding: 2} : {},
27
+ ]}>
28
+ <ImageIcon
29
+ iconType="plain"
30
+ name={'spotlight'}
31
+ tintColor={$config.PRIMARY_ACTION_BRAND_COLOR}
32
+ iconSize={20}
33
+ />
34
+ <PlatformWrapper>
35
+ <Text
36
+ numberOfLines={1}
37
+ textBreakStrategy="simple"
38
+ ellipsizeMode="tail"
39
+ style={[style.name]}>
40
+ {spotlightText}
41
+ </Text>
42
+ </PlatformWrapper>
43
+ </View>
44
+ );
45
+ };
46
+ const PlatformWrapper = ({children}) => {
47
+ return isWeb() ? (
48
+ <div
49
+ style={{
50
+ userSelect: 'none',
51
+ MozUserSelect: 'none',
52
+ WebkitUserSelect: 'none',
53
+ msUserSelect: 'none',
54
+ alignSelf: 'center',
55
+ overflow: 'hidden',
56
+ textOverflow: 'ellipsis',
57
+ color: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
58
+ }}>
59
+ {children}
60
+ </div>
61
+ ) : (
62
+ <>{children}</>
63
+ );
64
+ };
65
+
66
+ const style = StyleSheet.create({
67
+ container: {
68
+ backgroundColor:
69
+ $config.VIDEO_AUDIO_TILE_OVERLAY_COLOR + hexadecimalTransparency['25%'],
70
+ position: 'absolute',
71
+ alignItems: 'center',
72
+ padding: 8,
73
+ top: 8,
74
+ left: 8,
75
+ borderRadius: 4,
76
+ flexDirection: 'row',
77
+ zIndex: 999,
78
+ elevation: 5,
79
+ },
80
+ name: {
81
+ color: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
82
+ fontSize: ThemeConfig.FontSize.small,
83
+ fontWeight: '600',
84
+ fontFamily: ThemeConfig.FontFamily.sansPro,
85
+ flexShrink: 1,
86
+ marginLeft: 4,
87
+ marginRight: 2,
88
+ },
89
+ });
90
+
91
+ export default SpotlightHighligher;
@@ -10,7 +10,7 @@ import {MaxVideoView} from '../../../agora-rn-uikit';
10
10
  import FallbackLogo from '../../subComponents/FallbackLogo';
11
11
  import NetworkQualityPill from '../../subComponents/NetworkQualityPill';
12
12
  import NameWithMicIcon from './NameWithMicIcon';
13
- import {useLayout, useContent, useRtc, customEvents} from 'customization-api';
13
+ import {useLayout, useContent, useRtc, useSpotlight} from 'customization-api';
14
14
  import {
15
15
  DefaultLayouts,
16
16
  getGridLayoutName,
@@ -39,6 +39,7 @@ import {
39
39
  } from '../../language/default-labels/videoCallScreenLabels';
40
40
  import {LogSource, logger} from '../../logger/AppBuilderLogger';
41
41
  import {useFullScreen} from '../../utils/useFullScreen';
42
+ import SpotlightHighligher from './SpotlightHighlighter';
42
43
  export interface VideoRendererProps {
43
44
  user: ContentInterface;
44
45
  isMax?: boolean;
@@ -155,6 +156,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
155
156
  };
156
157
  });
157
158
  };
159
+ const {setSpotlightUid, spotlightUid} = useSpotlight();
158
160
 
159
161
  return (
160
162
  <>
@@ -170,6 +172,8 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
170
172
  user={user}
171
173
  btnRef={videoMoreMenuRef}
172
174
  from={'video-tile'}
175
+ setSpotlightUid={setSpotlightUid}
176
+ spotlightUid={spotlightUid}
173
177
  />
174
178
  <PlatformWrapper isHovered={isHovered} setIsHovered={setIsHovered}>
175
179
  <View
@@ -359,6 +363,11 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
359
363
  ) : (
360
364
  <></>
361
365
  )}
366
+ {$config.ENABLE_SPOTLIGHT && spotlightUid === user.uid ? (
367
+ <SpotlightHighligher />
368
+ ) : (
369
+ <></>
370
+ )}
362
371
  {!(isScreenShareOnFullView || isWhiteboardOnFullScreen) &&
363
372
  // user.uid !== rtcProps?.screenShareUid &&
364
373
  (isHovered || actionMenuVisible || isMobileUA()) ? (
@@ -39,6 +39,7 @@ const WHITEBOARD_ACTIVE = 'WHITEBOARD_ACTIVE';
39
39
  const BOARD_COLOR_CHANGED = 'BOARD_COLOR_CHANGED';
40
40
  const WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION = 'WHITEBOARD_L_I_U_P';
41
41
  const RECORDING_DELETED = 'RECORDING_DELETED';
42
+ const SPOTLIGHT_USER_CHANGED = 'SPOTLIGHT_USER_CHANGED';
42
43
  const EventNames = {
43
44
  RECORDING_STATE_ATTRIBUTE,
44
45
  RECORDING_STARTED_BY_ATTRIBUTE,
@@ -59,6 +60,7 @@ const EventNames = {
59
60
  BOARD_COLOR_CHANGED,
60
61
  WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION,
61
62
  RECORDING_DELETED,
63
+ SPOTLIGHT_USER_CHANGED,
62
64
  };
63
65
  /** ***** EVENT NAMES ENDS ***** */
64
66
 
@@ -0,0 +1,31 @@
1
+ import {DispatchContext, useContent} from 'customization-api';
2
+ import {useContext, useEffect} from 'react';
3
+ import {EventNames} from '../rtm-events';
4
+ import events from '../rtm-events-api';
5
+
6
+ export const useSpotlight = () => {
7
+ const {spotlightUid} = useContent();
8
+ const {dispatch} = useContext(DispatchContext);
9
+
10
+ useEffect(() => {
11
+ events.on(EventNames.SPOTLIGHT_USER_CHANGED, ({payload}) => {
12
+ if (payload) {
13
+ const data = JSON.parse(payload);
14
+ if (data && data?.user_id) {
15
+ setSpotlightUid(data?.user_id);
16
+ } else {
17
+ setSpotlightUid(0);
18
+ }
19
+ }
20
+ });
21
+ }, []);
22
+
23
+ const setSpotlightUid = (uid: number) => {
24
+ dispatch({
25
+ type: 'Spotlight',
26
+ value: [uid],
27
+ });
28
+ };
29
+
30
+ return {spotlightUid, setSpotlightUid};
31
+ };