Skip to content

Commit

Permalink
fix: remove chat state notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Nov 27, 2023
1 parent d46af4c commit e09cbff
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useCallback } from 'react';
import { selectPeerByID, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
import {
ChatIcon,
ChatUnreadIcon,
ConnectivityIcon,
HandIcon,
Expand Down Expand Up @@ -146,24 +145,6 @@ export const ToastConfig = {
};
},
},
CHAT_PAUSED: {
single: notification => {
return {
title: `Chat paused by ${notification.data?.name}`,
icon: <ChatIcon />,
action: <ChatAction />,
};
},
},
CHAT_RESUMED: {
single: notification => {
return {
title: `Chat resumed by ${notification.data?.name}`,
icon: <ChatUnreadIcon />,
action: <ChatAction />,
};
},
},
RECONNECTED: {
single: () => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@ import {
DefaultConferencingScreen_Elements,
HLSLiveStreamingScreen_Elements,
} from '@100mslive/types-prebuilt';
import { v4 as uuid } from 'uuid';
import {
selectIsConnectedToRoom,
selectLocalPeerName,
selectLocalPeerRoleName,
selectSessionStore,
useHMSActions,
useHMSStore,
} from '@100mslive/react-sdk';
import { selectIsConnectedToRoom, selectLocalPeerRoleName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
// @ts-ignore: No implicit Any
import FullPageProgress from '../components/FullPageProgress';
// @ts-ignore: No implicit Any
import { ToastBatcher } from '../components/Toast/ToastBatcher';
import { GridLayout } from '../components/VideoLayouts/GridLayout';
import { Box, Flex } from '../../Layout';
// @ts-ignore: No implicit Any
Expand Down Expand Up @@ -56,9 +46,6 @@ export const VideoStreamingSection = ({
const waitingViewerRole = useWaitingViewerRole();
const urlToIframe = useUrlToEmbed();
const pdfAnnotatorActive = usePDFConfig();
const localPeerName = useHMSStore(selectLocalPeerName);
const { enabled: isChatEnabled = true, updatedBy: chatStateUpdatedBy = '' } =
useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_STATE)) || {};

useEffect(() => {
if (!isConnected) {
Expand All @@ -74,15 +61,6 @@ export const VideoStreamingSection = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isConnected, hmsActions]);

useEffect(() => {
if (!chatStateUpdatedBy || chatStateUpdatedBy === localPeerName) {
return;
}
const type = isChatEnabled ? 'CHAT_RESUMED' : 'CHAT_PAUSED';
const notification = { id: uuid(), message: '', type, data: { name: chatStateUpdatedBy } };
ToastBatcher.showToast({ notification, type });
}, [isChatEnabled, chatStateUpdatedBy, localPeerName]);

if (!localPeerRole) {
// we don't know the role yet to decide how to render UI
return null;
Expand Down

0 comments on commit e09cbff

Please sign in to comment.