瀏覽代碼

feat: add option to disable desktop sharing

config.disableDesktopSharing - when set to false will disable desktop
sharing

interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP - when value is
assigned, will not hide the desktop sharing button completely, but show
as disabled with this value used as the tooltip text.
master
paweldomas 8 年之前
父節點
當前提交
b84e910086

+ 29
- 2
conference.js 查看文件

544
     audioMuted: false,
544
     audioMuted: false,
545
     videoMuted: false,
545
     videoMuted: false,
546
     isSharingScreen: false,
546
     isSharingScreen: false,
547
+    /**
548
+     * Indicates if the desktop sharing functionality has been enabled.
549
+     * It takes into consideration {@link isDesktopSharingDisabledByConfig}
550
+     * as well as the status returned by
551
+     * {@link JitsiMeetJS.isDesktopSharingEnabled()}. The latter can be false
552
+     * either if the desktop sharing is not supported by the current browser
553
+     * or if it was disabled through lib-jitsi-meet specific options (check
554
+     * config.js for listed options).
555
+     */
547
     isDesktopSharingEnabled: false,
556
     isDesktopSharingEnabled: false,
557
+    /**
558
+     * Set to <tt>true</tt> if the desktop sharing functionality has been
559
+     * explicitly disabled in the config.
560
+     */
561
+    isDesktopSharingDisabledByConfig: false,
562
+    /**
563
+     * The text displayed when the desktop sharing button is disabled through
564
+     * the config. The value is set through
565
+     * {@link interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP}.
566
+     */
567
+    desktopSharingDisabledTooltip: null,
548
     /*
568
     /*
549
      * Whether the local "raisedHand" flag is on.
569
      * Whether the local "raisedHand" flag is on.
550
      */
570
      */
601
                     ConnectionEvents.CONNECTION_FAILED,
621
                     ConnectionEvents.CONNECTION_FAILED,
602
                     _connectionFailedHandler);
622
                     _connectionFailedHandler);
603
                 APP.connection = connection = con;
623
                 APP.connection = connection = con;
604
-                this.isDesktopSharingEnabled =
605
-                    JitsiMeetJS.isDesktopSharingEnabled();
624
+
625
+                // Desktop sharing related stuff:
626
+                this.isDesktopSharingDisabledByConfig
627
+                    = config.disableDesktopSharing;
628
+                this.isDesktopSharingEnabled
629
+                    = !this.isDesktopSharingDisabledByConfig
630
+                        && JitsiMeetJS.isDesktopSharingEnabled();
631
+                this.desktopSharingDisabledTooltip
632
+                    = interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP;
606
                 eventEmitter.emit(
633
                 eventEmitter.emit(
607
                     JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
634
                     JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
608
                     this.isDesktopSharingEnabled);
635
                     this.isDesktopSharingEnabled);

+ 4
- 1
config.js 查看文件

26
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
26
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
27
     //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here
27
     //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here
28
     //defaultSipNumber: '', // Default SIP number
28
     //defaultSipNumber: '', // Default SIP number
29
-
29
+    /**
30
+     * Disables desktop sharing functionality.
31
+     */
32
+    disableDesktopSharing: false,
30
     // The ID of the jidesha extension for Chrome.
33
     // The ID of the jidesha extension for Chrome.
31
     desktopSharingChromeExtId: null,
34
     desktopSharingChromeExtId: null,
32
     // Whether desktop sharing should be disabled on Chrome.
35
     // Whether desktop sharing should be disabled on Chrome.

+ 6
- 0
interface_config.js 查看文件

2
     // TO FIX: this needs to be handled from SASS variables. There are some
2
     // TO FIX: this needs to be handled from SASS variables. There are some
3
     // methods allowing to use variables both in css and js.
3
     // methods allowing to use variables both in css and js.
4
     DEFAULT_BACKGROUND: '#474747',
4
     DEFAULT_BACKGROUND: '#474747',
5
+    /**
6
+     * In case the desktop sharing is disabled through the config the button
7
+     * will not be hidden, but displayed as disabled with this text us as
8
+     * a tooltip.
9
+     */
10
+    DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP: null,
5
     INITIAL_TOOLBAR_TIMEOUT: 20000,
11
     INITIAL_TOOLBAR_TIMEOUT: 20000,
6
     TOOLBAR_TIMEOUT: 4000,
12
     TOOLBAR_TIMEOUT: 4000,
7
     DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster",
13
     DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster",

+ 17
- 0
modules/UI/util/UIUtil.js 查看文件

167
         }
167
         }
168
     },
168
     },
169
 
169
 
170
+    /**
171
+     * Sets the tooltip to the given element, but instead of using translation
172
+     * key uses text value.
173
+     *
174
+     * @param element the element to set the tooltip to
175
+     * @param text the tooltip text
176
+     * @param position the position of the tooltip in relation to the element
177
+     */
178
+    setTooltipText(element, text, position) {
179
+        if (element) {
180
+            UIUtil.removeTooltip(element);
181
+
182
+            element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]);
183
+            element.setAttribute('content', text);
184
+        }
185
+    },
186
+
170
     /**
187
     /**
171
      * Removes the tooltip to the given element.
188
      * Removes the tooltip to the given element.
172
      *
189
      *

+ 14
- 5
react/features/toolbox/actions.web.js 查看文件

235
 export function showDesktopSharingButton(): Function {
235
 export function showDesktopSharingButton(): Function {
236
     return (dispatch: Dispatch<*>) => {
236
     return (dispatch: Dispatch<*>) => {
237
         const buttonName = 'desktop';
237
         const buttonName = 'desktop';
238
+        const disabledTooltipText
239
+            = APP.conference.desktopSharingDisabledTooltip;
240
+        const showTooltip
241
+            = disabledTooltipText
242
+                && APP.conference.isDesktopSharingDisabledByConfig;
238
         const visible
243
         const visible
239
-            = APP.conference.isDesktopSharingEnabled
240
-                && UIUtil.isButtonEnabled(buttonName);
244
+            = UIUtil.isButtonEnabled(buttonName)
245
+                && (APP.conference.isDesktopSharingEnabled || showTooltip);
241
 
246
 
242
-        dispatch(setToolbarButton(buttonName, {
243
-            hidden: !visible
244
-        }));
247
+        const newState = {
248
+            enabled: APP.conference.isDesktopSharingEnabled,
249
+            hidden: !visible,
250
+            tooltipText: showTooltip ? disabledTooltipText : undefined
251
+        };
252
+
253
+        dispatch(setToolbarButton(buttonName, newState));
245
     };
254
     };
246
 }
255
 }
247
 
256
 

+ 9
- 3
react/features/toolbox/components/ToolbarButton.web.js 查看文件

221
         if (UIUtil.isButtonEnabled(name)) {
221
         if (UIUtil.isButtonEnabled(name)) {
222
 
222
 
223
             if (!button.unclickable) {
223
             if (!button.unclickable) {
224
-                UIUtil.setTooltip(this.button,
225
-                    button.tooltipKey,
226
-                    tooltipPosition);
224
+                if (button.tooltipText) {
225
+                    UIUtil.setTooltipText(this.button,
226
+                        button.tooltipText,
227
+                        tooltipPosition);
228
+                } else {
229
+                    UIUtil.setTooltip(this.button,
230
+                        button.tooltipKey,
231
+                        tooltipPosition);
232
+                }
227
             }
233
             }
228
 
234
 
229
             if (button.shortcut) {
235
             if (button.shortcut) {

+ 4
- 0
react/features/toolbox/functions.web.js 查看文件

43
         result.style = { display: 'none' };
43
         result.style = { display: 'none' };
44
     }
44
     }
45
 
45
 
46
+    if (props.tooltipText) {
47
+        result.content = props.tooltipText;
48
+    }
49
+
46
     return result;
50
     return result;
47
 }
51
 }
48
 
52
 

Loading…
取消
儲存