diff --git a/packages/roomkit-react/package.json b/packages/roomkit-react/package.json index 7ac88de753..55a6b972c9 100644 --- a/packages/roomkit-react/package.json +++ b/packages/roomkit-react/package.json @@ -87,7 +87,7 @@ "@100mslive/hms-virtual-background": "1.13.3", "@100mslive/react-icons": "0.10.3", "@100mslive/react-sdk": "0.10.3", - "@100mslive/types-prebuilt": "0.12.7", + "@100mslive/types-prebuilt": "0.12.8", "@emoji-mart/data": "^1.0.6", "@emoji-mart/react": "^1.0.1", "@radix-ui/react-accordion": "1.0.0", diff --git a/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx b/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx index e581149b27..51f51f2123 100644 --- a/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/Chat/ChatFooter.tsx @@ -2,7 +2,7 @@ import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'reac import { useMedia } from 'react-use'; import data from '@emoji-mart/data'; import Picker from '@emoji-mart/react'; -import { HMSException, selectLocalPeer, useAVToggle, useHMSActions, useHMSStore } from '@100mslive/react-sdk'; +import { HMSException, selectLocalPeer, useHMSActions, useHMSStore } from '@100mslive/react-sdk'; import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from '@100mslive/react-icons'; import { Box, config as cssConfig, Flex, IconButton as BaseIconButton, Popover, styled, Text } from '../../..'; import { IconButton } from '../../../IconButton'; @@ -89,8 +89,6 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo const defaultSelection = useDefaultChatSelection(); const selection = selectedPeer.name || selectedRole || defaultSelection; const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true }); - const { toggleAudio, toggleVideo } = useAVToggle(); - const noAVPermissions = !(toggleAudio || toggleVideo); const isMwebHLSStream = useMobileHLSStream(); const isLandscapeHLSStream = useLandscapeHLSStream(); @@ -275,7 +273,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo }} gap="2" > - {noAVPermissions ? : null} + diff --git a/packages/roomkit-react/src/Prebuilt/components/ConferenceScreen.tsx b/packages/roomkit-react/src/Prebuilt/components/ConferenceScreen.tsx index 093766b05f..b75aebe5fe 100644 --- a/packages/roomkit-react/src/Prebuilt/components/ConferenceScreen.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/ConferenceScreen.tsx @@ -6,7 +6,6 @@ import { selectAppData, selectIsConnectedToRoom, selectRoomState, - useAVToggle, useHMSActions, useHMSStore, } from '@100mslive/react-sdk'; @@ -54,8 +53,6 @@ export const ConferenceScreen = () => { const dropdownListRef = useRef(); const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted); - const { toggleAudio, toggleVideo } = useAVToggle(); - const noAVPermissions = !(toggleAudio || toggleVideo); // using it in hls stream to show action button when chat is disabled const showChat = !!screenProps.elements?.chat; const autoRoomJoined = useRef(isPreviewScreenEnabled); @@ -202,7 +199,7 @@ export const ConferenceScreen = () => { justify="end" gap="2" > - {noAVPermissions ? : null} + {isMobile ? ( <> - {noAVPermissions ? : null} + {elements?.chat && } diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx index 697f30e7cd..2ade46c99d 100644 --- a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx @@ -29,7 +29,6 @@ import { FullScreenItem } from '../FullScreenItem'; import { MuteAllModal } from '../MuteAllModal'; // @ts-ignore: No implicit any import { useDropdownList } from '../../hooks/useDropdownList'; -// @ts-ignore: No implicit any import { useMyMetadata } from '../../hooks/useMetadata'; // @ts-ignore: No implicit any import { APP_DATA, isMacOS } from '../../../common/constants'; diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx index aefd7b5a0b..30cb6393fb 100644 --- a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx @@ -6,7 +6,6 @@ import { selectIsConnectedToRoom, selectPeerCount, selectPermissions, - useAVToggle, useHMSActions, useHMSStore, useRecordingStreaming, @@ -51,7 +50,6 @@ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane' import { useShowPolls } from '../../AppData/useUISettings'; // @ts-ignore: No implicit any import { useDropdownList } from '../../hooks/useDropdownList'; -// @ts-ignore: No implicit any import { useMyMetadata } from '../../hooks/useMetadata'; import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent'; import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks'; @@ -95,8 +93,6 @@ export const MwebOptions = ({ const peerCount = useHMSStore(selectPeerCount); const emojiCardRef = useRef(null); const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata(); - const { toggleAudio, toggleVideo } = useAVToggle(); - const noAVPermissions = !(toggleAudio || toggleVideo); const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent(); const { title, description } = useRoomLayoutHeader(); const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS); @@ -175,7 +171,7 @@ export const MwebOptions = ({ )} - {!noAVPermissions ? ( + {elements.hand_raise ? ( { diff --git a/packages/roomkit-react/src/Prebuilt/components/PreviousRoleInMetadata.tsx b/packages/roomkit-react/src/Prebuilt/components/PreviousRoleInMetadata.tsx index 110aa7d7b4..c94fd0daa5 100644 --- a/packages/roomkit-react/src/Prebuilt/components/PreviousRoleInMetadata.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/PreviousRoleInMetadata.tsx @@ -1,6 +1,5 @@ import { useEffect } from 'react'; import { selectLocalPeerRoleName, useHMSVanillaStore } from '@100mslive/react-sdk'; -// @ts-ignore: No implicit Any import { useMyMetadata } from './hooks/useMetadata'; export const PreviousRoleInMetadata = () => { diff --git a/packages/roomkit-react/src/Prebuilt/components/RaiseHand.tsx b/packages/roomkit-react/src/Prebuilt/components/RaiseHand.tsx index c391e3fa20..e3b61f45b1 100644 --- a/packages/roomkit-react/src/Prebuilt/components/RaiseHand.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/RaiseHand.tsx @@ -4,11 +4,17 @@ import { CSS } from '../../Theme'; import { Tooltip } from '../../Tooltip'; // @ts-ignore: No implicit Any import IconButton from '../IconButton'; -// @ts-ignore: No implicit Any +import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen'; import { useMyMetadata } from './hooks/useMetadata'; export const RaiseHand = ({ css }: { css?: CSS }) => { const { isHandRaised, toggleHandRaise } = useMyMetadata(); + const { elements } = useRoomLayoutConferencingScreen(); + + if (!elements.hand_raise) { + return null; + } + return ( { const metaData = useHMSStore(selectPeerMetadata(localPeerId)); const isHandRaised = useHMSStore(selectHasPeerHandRaised(localPeerId)); - const update = async updatedFields => { + const update = async (updatedFields: Record) => { try { // get current state from store and merge updated fields const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId)); @@ -24,6 +24,7 @@ export const useMyMetadata = () => { } catch (error) { console.error('failed to update metadata ', updatedFields); } + return false; }; const toggleHandRaise = useCallback(async () => { @@ -43,12 +44,6 @@ export const useMyMetadata = () => { } }, [metaData?.isBRBOn]); //eslint-disable-line - const setPrevRole = async role => { - await update({ - prevRole: role, - }); - }; - return { isHandRaised, isBRBOn: !!metaData?.isBRBOn, @@ -56,6 +51,5 @@ export const useMyMetadata = () => { updateMetaData: update, toggleHandRaise, toggleBRB, - setPrevRole, }; }; diff --git a/yarn.lock b/yarn.lock index e260b50eeb..625f38d30c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,10 +7,10 @@ resolved "https://registry.yarnpkg.com/@100mslive/hms-noise-cancellation/-/hms-noise-cancellation-0.0.1.tgz#037c8bdfb6b2d7bf12f9d257422150fe6ca43acb" integrity sha512-DGnzcXRDJREWypIjGX70er+f2k/XLLRF41lrXPs1+PtB1imdEkECPPS0Fg4BA0BCWKDNAGTZBHZPrBDgUmr9Lw== -"@100mslive/types-prebuilt@0.12.7": - version "0.12.7" - resolved "https://registry.yarnpkg.com/@100mslive/types-prebuilt/-/types-prebuilt-0.12.7.tgz#66e26701964a8c7a0ab7df4787ac64ad8f8870f4" - integrity sha512-GsDJCZA74+wuBorERQbVA0isRUQduBZzkyzRfMhFA29ZDaVTManrnwamf9TrZvrFJRFTVhZ6lv05oUaauqJRjA== +"@100mslive/types-prebuilt@0.12.8": + version "0.12.8" + resolved "https://registry.yarnpkg.com/@100mslive/types-prebuilt/-/types-prebuilt-0.12.8.tgz#2fe9007eb14e66ad3ba687313c4254e2ed085629" + integrity sha512-W1ISh3Mk8/wkomeFiBte7HZLk1gJocnN5U0N8rzZ9WFdDlAW7q/hKgnh+X1/9QxVcv3USfuZyKotbZ7AXmvCiQ== "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6"