2019-01-28 21:21:29 +08:00
|
|
|
import React from 'react';
|
2023-09-25 22:59:12 +08:00
|
|
|
import { useContext } from 'react';
|
2019-01-28 21:21:29 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import { injectIntl } from 'react-intl';
|
2024-01-27 00:21:58 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
2019-01-28 21:21:29 +08:00
|
|
|
import JoinVideoButton from './component';
|
2019-11-28 21:13:06 +08:00
|
|
|
import VideoService from '../service';
|
2023-05-23 03:54:41 +08:00
|
|
|
import {
|
|
|
|
updateSettings,
|
|
|
|
} from '/imports/ui/components/settings/service';
|
2023-09-25 22:59:12 +08:00
|
|
|
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
|
2024-01-27 00:21:58 +08:00
|
|
|
import { CAMERA_BROADCAST_STOP } from '../mutations';
|
2024-01-30 21:03:11 +08:00
|
|
|
import useUserChangedLocalSettings from '/imports/ui/services/settings/hooks/useUserChangedLocalSettings';
|
2024-04-25 04:16:21 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2019-04-19 01:14:34 +08:00
|
|
|
|
2019-01-28 21:21:29 +08:00
|
|
|
const JoinVideoOptionsContainer = (props) => {
|
|
|
|
const {
|
2023-05-23 03:54:41 +08:00
|
|
|
updateSettings,
|
2019-11-28 21:13:06 +08:00
|
|
|
hasVideoStream,
|
2020-09-10 02:07:32 +08:00
|
|
|
disableReason,
|
2022-04-05 01:02:50 +08:00
|
|
|
status,
|
2019-01-28 21:21:29 +08:00
|
|
|
intl,
|
|
|
|
...restProps
|
|
|
|
} = props;
|
|
|
|
|
2024-01-27 00:21:58 +08:00
|
|
|
const [cameraBroadcastStop] = useMutation(CAMERA_BROADCAST_STOP);
|
2024-01-30 21:03:11 +08:00
|
|
|
const setLocalSettings = useUserChangedLocalSettings();
|
2024-01-27 00:21:58 +08:00
|
|
|
|
|
|
|
const sendUserUnshareWebcam = (cameraId) => {
|
|
|
|
cameraBroadcastStop({ variables: { cameraId } });
|
|
|
|
};
|
|
|
|
|
2023-09-25 22:59:12 +08:00
|
|
|
const {
|
2023-11-29 02:31:28 +08:00
|
|
|
pluginsExtensibleAreasAggregatedState,
|
2023-09-25 22:59:12 +08:00
|
|
|
} = useContext(PluginsContext);
|
|
|
|
let cameraSettingsDropdownItems = [];
|
2023-11-29 02:31:28 +08:00
|
|
|
if (pluginsExtensibleAreasAggregatedState.cameraSettingsDropdownItems) {
|
2023-09-25 22:59:12 +08:00
|
|
|
cameraSettingsDropdownItems = [
|
2023-11-29 02:31:28 +08:00
|
|
|
...pluginsExtensibleAreasAggregatedState.cameraSettingsDropdownItems,
|
2023-09-25 22:59:12 +08:00
|
|
|
];
|
|
|
|
}
|
2024-04-25 04:16:21 +08:00
|
|
|
|
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
away: user.away,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const away = currentUserData?.away;
|
|
|
|
|
2019-11-28 21:13:06 +08:00
|
|
|
return (
|
|
|
|
<JoinVideoButton {...{
|
2023-09-25 22:59:12 +08:00
|
|
|
cameraSettingsDropdownItems,
|
|
|
|
hasVideoStream,
|
|
|
|
updateSettings,
|
|
|
|
disableReason,
|
|
|
|
status,
|
2024-01-27 00:21:58 +08:00
|
|
|
sendUserUnshareWebcam,
|
2024-01-30 21:03:11 +08:00
|
|
|
setLocalSettings,
|
2024-04-25 04:16:21 +08:00
|
|
|
away,
|
2023-09-25 22:59:12 +08:00
|
|
|
...restProps,
|
2019-11-28 21:13:06 +08:00
|
|
|
}}
|
|
|
|
/>
|
2019-04-19 01:14:34 +08:00
|
|
|
);
|
2019-01-28 21:21:29 +08:00
|
|
|
};
|
|
|
|
|
2023-03-27 23:36:25 +08:00
|
|
|
export default injectIntl(withTracker(() => ({
|
2019-11-28 21:13:06 +08:00
|
|
|
hasVideoStream: VideoService.hasVideoStream(),
|
2023-05-23 03:54:41 +08:00
|
|
|
updateSettings,
|
2020-09-10 02:07:32 +08:00
|
|
|
disableReason: VideoService.disableReason(),
|
2022-04-05 01:02:50 +08:00
|
|
|
status: VideoService.getStatus(),
|
2023-03-27 23:36:25 +08:00
|
|
|
}))(JoinVideoOptionsContainer));
|