removal: remove withTracker from PresentationToolbarContainer component

This commit is contained in:
João Victor 2024-05-16 11:43:23 -03:00
parent 34b73b66d7
commit 275bcbc68e
2 changed files with 20 additions and 8 deletions

View File

@ -1,9 +1,8 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { withTracker } from 'meteor/react-meteor-data';
import PresentationToolbar from './component';
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
import { isPollingEnabled } from '/imports/ui/services/features';
import { useIsPollingEnabled } from '/imports/ui/services/features';
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
import { useSubscription, useMutation } from '@apollo/client';
import POLL_SUBSCRIPTION from '/imports/ui/core/graphql/queries/pollSubscription';
@ -75,6 +74,8 @@ const PresentationToolbarContainer = (props) => {
});
};
const isPollingEnabled = useIsPollingEnabled();
if (userIsPresenter && !layoutSwapped) {
// Only show controls if user is presenter and layout isn't swapped
@ -86,6 +87,9 @@ const PresentationToolbarContainer = (props) => {
{...props}
amIPresenter={userIsPresenter}
endCurrentPoll={endCurrentPoll}
isPollingEnabled={isPollingEnabled}
// TODO: Remove this
isMeteorConnected
{...{
pluginProvidedPresentationToolbarItems,
handleToggleFullScreen,
@ -100,12 +104,7 @@ const PresentationToolbarContainer = (props) => {
return null;
};
export default withTracker(() => {
return {
isMeteorConnected: Meteor.status().connected,
isPollingEnabled: isPollingEnabled(),
};
})(PresentationToolbarContainer);
export default PresentationToolbarContainer;
PresentationToolbarContainer.propTypes = {
// Number of current slide being displayed

View File

@ -1,5 +1,6 @@
import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings';
import useMeeting from '../../core/hooks/useMeeting';
export function getDisabledFeatures() {
const selector = {
@ -12,6 +13,14 @@ export function getDisabledFeatures() {
return disabledFeatures;
}
export function useDisabledFeatures() {
const { data: meetingData } = useMeeting((m) => ({
disabledFeatures: m.disabledFeatures,
}));
const disabledFeatures = meetingData?.disabledFeatures || [];
return disabledFeatures;
}
export function isScreenSharingEnabled() {
return getDisabledFeatures().indexOf('screenshare') === -1 && window.meetingClientSettings.public.kurento.enableScreensharing;
}
@ -24,6 +33,10 @@ export function isPollingEnabled() {
return getDisabledFeatures().indexOf('polls') === -1 && window.meetingClientSettings.public.poll.enabled;
}
export function useIsPollingEnabled() {
return useDisabledFeatures().indexOf('polls') === -1 && window.meetingClientSettings.public.poll.enabled;
}
export function isExternalVideoEnabled() {
return getDisabledFeatures().indexOf('externalVideos') === -1 && window.meetingClientSettings.public.externalVideoPlayer.enabled;
}