Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(toolbar): use old toolbar logic for showing screenshare

Leonard Kim4c49e3bec05c
diff --git a/lang/main.json b/lang/main.json
index 3f9ea79a26..89d2f7301b 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 7be927485b..8b965f8f3a 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<Props, State> {
* @returns {void}
*/
_onToolbarToggleScreenshare() {
+ if (!this.props._desktopSharingEnabled) {
+ return;
+ }
+
sendAnalytics(createShortcutEvent(
'toggle.screen.sharing',
ACTION_SHORTCUT_TRIGGERED,
@@ -897,20 +906,35 @@ class ToolboxV2 extends Component<Props, State> {
}
/**
- * 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 (
<ToolbarButtonV2
@@ -1073,6 +1097,7 @@ function _mapStateToProps(state) {
} = state['features/base/conference'];
const {
callStatsID,
+ disableDesktopSharing,
enableRecording,
enableUserRolesBasedOnToken,
iAmRecorder
@@ -1101,6 +1126,7 @@ function _mapStateToProps(state) {
_chatOpen: current === 'chat_container',
_conference: conference,
_desktopSharingEnabled: desktopSharingEnabled,
+ _desktopSharingDisabledByConfig: disableDesktopSharing,
_dialOutAvailable: isDialOutAvailable,
_dialog: Boolean(state['features/base/dialog'].component),
_editingDocument: Boolean(state['features/etherpad'].editing),