瀏覽代碼

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,7 +88,6 @@
88 88
         "documentClose": "Close shared document",
89 89
         "sharedvideo": "Share a YouTube video",
90 90
         "sharescreen": "Screen share",
91
-        "sharescreenDisabled": "Screen share disabled",
92 91
         "stopSharedVideo": "Stop YouTube video",
93 92
         "fullscreen": "View / Exit full screen",
94 93
         "sip": "Call SIP number",

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

@@ -55,6 +55,11 @@ type Props = {
55 55
      */
56 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 64
      * Whether or not screensharing is initialized.
60 65
      */
@@ -855,6 +860,10 @@ class ToolboxV2 extends Component<Props, State> {
855 860
      * @returns {void}
856 861
      */
857 862
     _onToolbarToggleScreenshare() {
863
+        if (!this.props._desktopSharingEnabled) {
864
+            return;
865
+        }
866
+
858 867
         sendAnalytics(createShortcutEvent(
859 868
             'toggle.screen.sharing',
860 869
             ACTION_SHORTCUT_TRIGGERED,
@@ -897,20 +906,35 @@ class ToolboxV2 extends Component<Props, State> {
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 911
      * @private
903
-     * @returns {ReactElement}
912
+     * @returns {ReactElement|null}
904 913
      */
905 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 932
         const classNames = `icon-share-desktop ${
908 933
             _screensharing ? 'toggled' : ''} ${
909 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 939
         return (
916 940
             <ToolbarButtonV2
@@ -1073,6 +1097,7 @@ function _mapStateToProps(state) {
1073 1097
     } = state['features/base/conference'];
1074 1098
     const {
1075 1099
         callStatsID,
1100
+        disableDesktopSharing,
1076 1101
         enableRecording,
1077 1102
         enableUserRolesBasedOnToken,
1078 1103
         iAmRecorder
@@ -1101,6 +1126,7 @@ function _mapStateToProps(state) {
1101 1126
         _chatOpen: current === 'chat_container',
1102 1127
         _conference: conference,
1103 1128
         _desktopSharingEnabled: desktopSharingEnabled,
1129
+        _desktopSharingDisabledByConfig: disableDesktopSharing,
1104 1130
         _dialOutAvailable: isDialOutAvailable,
1105 1131
         _dialog: Boolean(state['features/base/dialog'].component),
1106 1132
         _editingDocument: Boolean(state['features/etherpad'].editing),

Loading…
取消
儲存