/* * Wire * Copyright (C) 2024 Wire Swiss GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * */ import cx from 'classnames'; import {container} from 'tsyringe'; import { cellControlsList, cellControlsWrapper, } from 'Components/calling/CallingCell/CallingControls/CallingControls.styles'; import {useCallAlertState} from 'Components/calling/useCallAlertState'; import * as Icon from 'Components/Icon'; import {DesktopScreenShareMenu} from 'src/script/calling/CallState'; import {useKoSubscribableChildren} from 'Util/ComponentUtil'; import {t} from 'Util/LocalizerUtil'; import {Call} from '../../../../calling/Call'; import {Participant} from '../../../../calling/Participant'; import {TeamState} from '../../../../team/TeamState'; import {CallActions} from '../../../../view_model/CallingViewModel'; interface CallingControlsProps { answerCall: () => void; call: Call; callActions: CallActions; call1To1StartedAlert: string; isDetachedWindow: boolean; isFullUi?: boolean; isMuted?: boolean; isIncoming: boolean; isOutgoing: boolean; isOngoing: boolean; isDeclined: boolean; isGroup: boolean; isVideoCall: boolean; isConnecting?: boolean; selfParticipant: Participant; disableScreenButton: boolean; teamState: TeamState; supportsVideoCall: boolean; } export const CallingControls = ({ answerCall, call, callActions, call1To1StartedAlert, isFullUi, isMuted, isConnecting, isDetachedWindow, isIncoming, isOutgoing, isDeclined, disableScreenButton, isVideoCall, isOngoing, isGroup, selfParticipant, teamState = container.resolve(TeamState), supportsVideoCall, }: CallingControlsProps) => { const {isVideoCallingEnabled} = useKoSubscribableChildren(teamState, ['isVideoCallingEnabled']); const {sharesScreen: selfSharesScreen, sharesCamera: selfSharesCamera} = useKoSubscribableChildren(selfParticipant, [ 'sharesScreen', 'sharesCamera', ]); const {showAlert, clearShowAlert} = useCallAlertState(); const isVideoUnsupported = !selfSharesCamera && !supportsVideoCall; const showVideoButton = isVideoCallingEnabled && (isVideoCall || isOngoing); const disableVideoButton = (isOutgoing && selfSharesCamera) || isVideoUnsupported; return (
); };