瀏覽代碼

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.
master
Leonard Kim 7 年之前
父節點
當前提交
4c49e3bec0
共有 2 個文件被更改,包括 33 次插入8 次删除
  1. 0
    1
      lang/main.json
  2. 33
    7
      react/features/toolbox/components/ToolboxV2.web.js

+ 0
- 1
lang/main.json 查看文件

88
         "documentClose": "Close shared document",
88
         "documentClose": "Close shared document",
89
         "sharedvideo": "Share a YouTube video",
89
         "sharedvideo": "Share a YouTube video",
90
         "sharescreen": "Screen share",
90
         "sharescreen": "Screen share",
91
-        "sharescreenDisabled": "Screen share disabled",
92
         "stopSharedVideo": "Stop YouTube video",
91
         "stopSharedVideo": "Stop YouTube video",
93
         "fullscreen": "View / Exit full screen",
92
         "fullscreen": "View / Exit full screen",
94
         "sip": "Call SIP number",
93
         "sip": "Call SIP number",

+ 33
- 7
react/features/toolbox/components/ToolboxV2.web.js 查看文件

55
      */
55
      */
56
     _conference: Object,
56
     _conference: Object,
57
 
57
 
58
+    /**
59
+     * Whether or not desktopsharing was explicitly configured to be disabled.
60
+     */
61
+    _desktopSharingDisabledByConfig: boolean,
62
+
58
     /**
63
     /**
59
      * Whether or not screensharing is initialized.
64
      * Whether or not screensharing is initialized.
60
      */
65
      */
855
      * @returns {void}
860
      * @returns {void}
856
      */
861
      */
857
     _onToolbarToggleScreenshare() {
862
     _onToolbarToggleScreenshare() {
863
+        if (!this.props._desktopSharingEnabled) {
864
+            return;
865
+        }
866
+
858
         sendAnalytics(createShortcutEvent(
867
         sendAnalytics(createShortcutEvent(
859
             'toggle.screen.sharing',
868
             'toggle.screen.sharing',
860
             ACTION_SHORTCUT_TRIGGERED,
869
             ACTION_SHORTCUT_TRIGGERED,
897
     }
906
     }
898
 
907
 
899
     /**
908
     /**
900
-     * Renders a button for togglein screen sharing.
909
+     * Renders a button for toggleing screen sharing.
901
      *
910
      *
902
      * @private
911
      * @private
903
-     * @returns {ReactElement}
912
+     * @returns {ReactElement|null}
904
      */
913
      */
905
     _renderDesktopSharingButton() {
914
     _renderDesktopSharingButton() {
906
-        const { _desktopSharingEnabled, _screensharing, t } = this.props;
915
+        const {
916
+            _desktopSharingDisabledByConfig,
917
+            _desktopSharingEnabled,
918
+            _screensharing,
919
+            t
920
+        } = this.props;
921
+
922
+        const disabledTooltipText
923
+            = interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP;
924
+        const showDisabledTooltip
925
+            = disabledTooltipText && _desktopSharingDisabledByConfig;
926
+        const visible = _desktopSharingEnabled || showDisabledTooltip;
927
+
928
+        if (!visible) {
929
+            return null;
930
+        }
931
+
907
         const classNames = `icon-share-desktop ${
932
         const classNames = `icon-share-desktop ${
908
             _screensharing ? 'toggled' : ''} ${
933
             _screensharing ? 'toggled' : ''} ${
909
             _desktopSharingEnabled ? '' : 'disabled'}`;
934
             _desktopSharingEnabled ? '' : 'disabled'}`;
910
-        const tooltip = _desktopSharingEnabled
911
-            ? t('toolbar.sharescreen')
912
-            : interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP
913
-                || t('toolbar.sharescreenDisabled');
935
+        const tooltip = showDisabledTooltip
936
+            ? disabledTooltipText
937
+            : t('toolbar.sharescreen');
914
 
938
 
915
         return (
939
         return (
916
             <ToolbarButtonV2
940
             <ToolbarButtonV2
1073
     } = state['features/base/conference'];
1097
     } = state['features/base/conference'];
1074
     const {
1098
     const {
1075
         callStatsID,
1099
         callStatsID,
1100
+        disableDesktopSharing,
1076
         enableRecording,
1101
         enableRecording,
1077
         enableUserRolesBasedOnToken,
1102
         enableUserRolesBasedOnToken,
1078
         iAmRecorder
1103
         iAmRecorder
1101
         _chatOpen: current === 'chat_container',
1126
         _chatOpen: current === 'chat_container',
1102
         _conference: conference,
1127
         _conference: conference,
1103
         _desktopSharingEnabled: desktopSharingEnabled,
1128
         _desktopSharingEnabled: desktopSharingEnabled,
1129
+        _desktopSharingDisabledByConfig: disableDesktopSharing,
1104
         _dialOutAvailable: isDialOutAvailable,
1130
         _dialOutAvailable: isDialOutAvailable,
1105
         _dialog: Boolean(state['features/base/dialog'].component),
1131
         _dialog: Boolean(state['features/base/dialog'].component),
1106
         _editingDocument: Boolean(state['features/etherpad'].editing),
1132
         _editingDocument: Boolean(state['features/etherpad'].editing),

Loading…
取消
儲存