@100mslive/roomkit-react 0.3.3-alpha.7 → 0.3.3-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,7 @@ import {
6
6
  selectIsConnectedToRoom,
7
7
  selectPeerCount,
8
8
  selectPermissions,
9
+ useAVToggle,
9
10
  useHMSActions,
10
11
  useHMSStore,
11
12
  useRecordingStreaming,
@@ -50,6 +51,7 @@ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane'
50
51
  import { useShowPolls } from '../../AppData/useUISettings';
51
52
  // @ts-ignore: No implicit any
52
53
  import { useDropdownList } from '../../hooks/useDropdownList';
54
+ // @ts-ignore: No implicit any
53
55
  import { useMyMetadata } from '../../hooks/useMetadata';
54
56
  import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent';
55
57
  import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks';
@@ -93,6 +95,8 @@ export const MwebOptions = ({
93
95
  const peerCount = useHMSStore(selectPeerCount);
94
96
  const emojiCardRef = useRef(null);
95
97
  const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
98
+ const { toggleAudio, toggleVideo } = useAVToggle();
99
+ const noAVPermissions = !(toggleAudio || toggleVideo);
96
100
  const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
97
101
  const { title, description } = useRoomLayoutHeader();
98
102
  const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
@@ -171,7 +175,7 @@ export const MwebOptions = ({
171
175
  </ActionTile.Root>
172
176
  )}
173
177
 
174
- {elements.hand_raise ? (
178
+ {!noAVPermissions ? (
175
179
  <ActionTile.Root
176
180
  active={isHandRaised}
177
181
  onClick={() => {
@@ -1,5 +1,6 @@
1
1
  import { useEffect } from 'react';
2
2
  import { selectLocalPeerRoleName, useHMSVanillaStore } from '@100mslive/react-sdk';
3
+ // @ts-ignore: No implicit Any
3
4
  import { useMyMetadata } from './hooks/useMetadata';
4
5
 
5
6
  export const PreviousRoleInMetadata = () => {
@@ -4,17 +4,11 @@ import { CSS } from '../../Theme';
4
4
  import { Tooltip } from '../../Tooltip';
5
5
  // @ts-ignore: No implicit Any
6
6
  import IconButton from '../IconButton';
7
- import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
7
+ // @ts-ignore: No implicit Any
8
8
  import { useMyMetadata } from './hooks/useMetadata';
9
9
 
10
10
  export const RaiseHand = ({ css }: { css?: CSS }) => {
11
11
  const { isHandRaised, toggleHandRaise } = useMyMetadata();
12
- const { elements } = useRoomLayoutConferencingScreen();
13
-
14
- if (!elements.hand_raise) {
15
- return null;
16
- }
17
-
18
12
  return (
19
13
  <Tooltip title={isHandRaised ? 'Lower hand' : 'Raise hand'}>
20
14
  <IconButton
@@ -13,6 +13,7 @@ import { Flex, Text } from '../../..';
13
13
  import { PreviewControls, PreviewTile } from '../Preview/PreviewJoin';
14
14
  import { RequestPrompt } from './RequestPrompt';
15
15
  import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
16
+ // @ts-ignore: No implicit Any
16
17
  import { useMyMetadata } from '../hooks/useMetadata';
17
18
  // @ts-ignore: No implicit Any
18
19
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
@@ -15,7 +15,7 @@ export const useMyMetadata = () => {
15
15
  const metaData = useHMSStore(selectPeerMetadata(localPeerId));
16
16
  const isHandRaised = useHMSStore(selectHasPeerHandRaised(localPeerId));
17
17
 
18
- const update = async (updatedFields: Record<string, any>) => {
18
+ const update = async updatedFields => {
19
19
  try {
20
20
  // get current state from store and merge updated fields
21
21
  const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
@@ -24,7 +24,6 @@ export const useMyMetadata = () => {
24
24
  } catch (error) {
25
25
  console.error('failed to update metadata ', updatedFields);
26
26
  }
27
- return false;
28
27
  };
29
28
 
30
29
  const toggleHandRaise = useCallback(async () => {
@@ -44,6 +43,12 @@ export const useMyMetadata = () => {
44
43
  }
45
44
  }, [metaData?.isBRBOn]); //eslint-disable-line
46
45
 
46
+ const setPrevRole = async role => {
47
+ await update({
48
+ prevRole: role,
49
+ });
50
+ };
51
+
47
52
  return {
48
53
  isHandRaised,
49
54
  isBRBOn: !!metaData?.isBRBOn,
@@ -51,5 +56,6 @@ export const useMyMetadata = () => {
51
56
  updateMetaData: update,
52
57
  toggleHandRaise,
53
58
  toggleBRB,
59
+ setPrevRole,
54
60
  };
55
61
  };
@@ -1,8 +0,0 @@
1
- export declare const useMyMetadata: () => {
2
- isHandRaised: boolean;
3
- isBRBOn: boolean;
4
- metaData: any;
5
- updateMetaData: (updatedFields: Record<string, any>) => Promise<boolean>;
6
- toggleHandRaise: () => Promise<void>;
7
- toggleBRB: () => Promise<void>;
8
- };