From d0b95b7d3da5d6d44ab069d9f78c4673fb477b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 1 Sep 2021 18:03:15 +0200 Subject: [PATCH] Don't use a callback in setScreensharingEnabled() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/voip/CallView.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/views/voip/CallView.tsx b/src/components/views/voip/CallView.tsx index 9d82291286..cec67499ae 100644 --- a/src/components/views/voip/CallView.tsx +++ b/src/components/views/voip/CallView.tsx @@ -273,14 +273,14 @@ export default class CallView extends React.Component { }; private onScreenshareClick = async (): Promise => { - const isScreensharing = await this.props.call.setScreensharingEnabled( - !this.state.screensharing, - async (): Promise => { - const { finished } = Modal.createDialog(DesktopCapturerSourcePicker); - const [source] = await finished; - return source; - }, - ); + let isScreensharing; + if (this.state.screensharing) { + isScreensharing = await this.props.call.setScreensharingEnabled(false); + } else { + const { finished } = Modal.createDialog(DesktopCapturerSourcePicker); + const [source] = await finished; + isScreensharing = await this.props.call.setScreensharingEnabled(true, source); + } this.setState({ sidebarShown: true,