2021-04-07 03:58:11 +08:00
|
|
|
import React, { useContext } from 'react';
|
2019-06-13 02:40:58 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2019-02-22 05:01:39 +08:00
|
|
|
import { injectIntl } from 'react-intl';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2018-11-13 06:09:04 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2019-02-22 05:01:39 +08:00
|
|
|
import PresentationService from '/imports/ui/components/presentation/service';
|
2019-07-08 22:33:32 +08:00
|
|
|
import Presentations from '/imports/api/presentations';
|
2021-04-07 03:58:11 +08:00
|
|
|
import { UsersContext } from '../components-data/users-context/context';
|
2016-05-20 21:46:30 +08:00
|
|
|
import ActionsBar from './component';
|
2016-11-08 02:19:00 +08:00
|
|
|
import Service from './service';
|
2021-03-22 01:06:16 +08:00
|
|
|
import UserListService from '/imports/ui/components/user-list/service';
|
2019-04-25 01:19:35 +08:00
|
|
|
import ExternalVideoService from '/imports/ui/components/external-video-player/service';
|
2019-05-17 04:11:10 +08:00
|
|
|
import CaptionsService from '/imports/ui/components/captions/service';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutSelectOutput, layoutDispatch } from '../layout/context';
|
2020-08-19 04:35:56 +08:00
|
|
|
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
|
2022-03-09 21:33:18 +08:00
|
|
|
import { isExternalVideoEnabled, isPollingEnabled } from '/imports/ui/services/features';
|
2017-05-02 03:52:57 +08:00
|
|
|
|
2019-07-08 22:33:32 +08:00
|
|
|
import MediaService, {
|
|
|
|
getSwapLayout,
|
2021-10-15 03:31:47 +08:00
|
|
|
shouldEnableSwapLayout,
|
2019-07-08 22:33:32 +08:00
|
|
|
} from '../media/service';
|
2018-12-15 04:16:15 +08:00
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
const ActionsBarContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const actionsBarStyle = layoutSelectOutput((i) => i.actionBar);
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-09-10 04:49:15 +08:00
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
2021-04-20 01:54:14 +08:00
|
|
|
|
2021-04-20 03:27:35 +08:00
|
|
|
const currentUser = { userId: Auth.userID, emoji: users[Auth.meetingID][Auth.userID].emoji };
|
2021-04-20 01:54:14 +08:00
|
|
|
|
2021-11-24 00:04:45 +08:00
|
|
|
const amIPresenter = users[Auth.meetingID][Auth.userID].presenter;
|
|
|
|
|
2021-04-07 03:58:11 +08:00
|
|
|
return (
|
|
|
|
<ActionsBar {
|
|
|
|
...{
|
|
|
|
...props,
|
|
|
|
currentUser,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-22 22:04:38 +08:00
|
|
|
actionsBarStyle,
|
2021-11-24 00:04:45 +08:00
|
|
|
amIPresenter,
|
2021-04-07 03:58:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-03-08 20:33:25 +08:00
|
|
|
const PRESENTATION_DISABLED = Meteor.settings.public.layout.hidePresentation;
|
2021-03-20 02:52:03 +08:00
|
|
|
const SELECT_RANDOM_USER_ENABLED = Meteor.settings.public.selectRandomUser.enabled;
|
2021-05-19 00:34:42 +08:00
|
|
|
const RAISE_HAND_BUTTON_ENABLED = Meteor.settings.public.app.raiseHandActionButton.enabled;
|
2021-10-15 03:31:47 +08:00
|
|
|
const OLD_MINIMIZE_BUTTON_ENABLED = Meteor.settings.public.presentation.oldMinimizeButton;
|
2016-04-29 03:02:51 +08:00
|
|
|
|
2019-09-05 02:32:58 +08:00
|
|
|
export default withTracker(() => ({
|
2019-09-07 04:28:02 +08:00
|
|
|
amIModerator: Service.amIModerator(),
|
2019-09-05 02:32:58 +08:00
|
|
|
stopExternalVideoShare: ExternalVideoService.stopWatching,
|
2019-11-06 00:59:00 +08:00
|
|
|
enableVideo: getFromUserSettings('bbb_enable_video', Meteor.settings.public.kurento.enableVideo),
|
2021-11-24 00:04:45 +08:00
|
|
|
isLayoutSwapped: getSwapLayout() && shouldEnableSwapLayout(),
|
2019-09-05 02:32:58 +08:00
|
|
|
toggleSwapLayout: MediaService.toggleSwapLayout,
|
|
|
|
handleTakePresenter: Service.takePresenterRole,
|
|
|
|
currentSlidHasContent: PresentationService.currentSlidHasContent(),
|
|
|
|
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
|
|
|
|
isSharingVideo: Service.isSharingVideo(),
|
2021-09-28 03:13:06 +08:00
|
|
|
hasScreenshare: isVideoBroadcasting(),
|
2019-09-05 02:32:58 +08:00
|
|
|
isCaptionsAvailable: CaptionsService.isCaptionsAvailable(),
|
|
|
|
isMeteorConnected: Meteor.status().connected,
|
2022-03-09 02:05:24 +08:00
|
|
|
isPollingEnabled: isPollingEnabled(),
|
2021-03-08 20:33:25 +08:00
|
|
|
isPresentationDisabled: PRESENTATION_DISABLED,
|
2021-03-20 02:52:03 +08:00
|
|
|
isSelectRandomUserEnabled: SELECT_RANDOM_USER_ENABLED,
|
2021-05-19 00:34:42 +08:00
|
|
|
isRaiseHandButtonEnabled: RAISE_HAND_BUTTON_ENABLED,
|
2021-10-15 03:31:47 +08:00
|
|
|
isOldMinimizeButtonEnabled: OLD_MINIMIZE_BUTTON_ENABLED,
|
2019-09-05 02:32:58 +08:00
|
|
|
isThereCurrentPresentation: Presentations.findOne({ meetingId: Auth.meetingID, current: true },
|
2021-09-25 02:37:55 +08:00
|
|
|
{ fields: {} }),
|
2022-03-09 21:33:18 +08:00
|
|
|
allowExternalVideo: isExternalVideoEnabled(),
|
2021-03-22 01:06:16 +08:00
|
|
|
setEmojiStatus: UserListService.setEmojiStatus,
|
2019-09-05 02:32:58 +08:00
|
|
|
}))(injectIntl(ActionsBarContainer));
|