From 4c49e3bec05c5b0901ba394e2dd1efc77df75d88 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 29 Mar 2018 10:31:03 -0700 Subject: [PATCH] fix(toolbar): use old toolbar logic for showing screenshare I don't understand the old showDesktopSharingButton action but I've tried my best to copy it over. There is an existing issue where the keyboard shortcut gets registered when it probably shouldn't because screensharing is disabled. It will be fixed soon with refactoring of the entire logic determining whether or not to show the screensharing button. --- lang/main.json | 1 - .../toolbox/components/ToolboxV2.web.js | 40 +++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lang/main.json b/lang/main.json index 3f9ea79a2..89d2f7301 100644 --- a/lang/main.json +++ b/lang/main.json @@ -88,7 +88,6 @@ "documentClose": "Close shared document", "sharedvideo": "Share a YouTube video", "sharescreen": "Screen share", - "sharescreenDisabled": "Screen share disabled", "stopSharedVideo": "Stop YouTube video", "fullscreen": "View / Exit full screen", "sip": "Call SIP number", diff --git a/react/features/toolbox/components/ToolboxV2.web.js b/react/features/toolbox/components/ToolboxV2.web.js index 7be927485..8b965f8f3 100644 --- a/react/features/toolbox/components/ToolboxV2.web.js +++ b/react/features/toolbox/components/ToolboxV2.web.js @@ -55,6 +55,11 @@ type Props = { */ _conference: Object, + /** + * Whether or not desktopsharing was explicitly configured to be disabled. + */ + _desktopSharingDisabledByConfig: boolean, + /** * Whether or not screensharing is initialized. */ @@ -855,6 +860,10 @@ class ToolboxV2 extends Component { * @returns {void} */ _onToolbarToggleScreenshare() { + if (!this.props._desktopSharingEnabled) { + return; + } + sendAnalytics(createShortcutEvent( 'toggle.screen.sharing', ACTION_SHORTCUT_TRIGGERED, @@ -897,20 +906,35 @@ class ToolboxV2 extends Component { } /** - * Renders a button for togglein screen sharing. + * Renders a button for toggleing screen sharing. * * @private - * @returns {ReactElement} + * @returns {ReactElement|null} */ _renderDesktopSharingButton() { - const { _desktopSharingEnabled, _screensharing, t } = this.props; + const { + _desktopSharingDisabledByConfig, + _desktopSharingEnabled, + _screensharing, + t + } = this.props; + + const disabledTooltipText + = interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP; + const showDisabledTooltip + = disabledTooltipText && _desktopSharingDisabledByConfig; + const visible = _desktopSharingEnabled || showDisabledTooltip; + + if (!visible) { + return null; + } + const classNames = `icon-share-desktop ${ _screensharing ? 'toggled' : ''} ${ _desktopSharingEnabled ? '' : 'disabled'}`; - const tooltip = _desktopSharingEnabled - ? t('toolbar.sharescreen') - : interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP - || t('toolbar.sharescreenDisabled'); + const tooltip = showDisabledTooltip + ? disabledTooltipText + : t('toolbar.sharescreen'); return (