Browse Source

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 years ago
parent
commit
b84e910086

+ 29
- 2
conference.js View File

@@ -544,7 +544,27 @@ export default {
544 544
     audioMuted: false,
545 545
     videoMuted: false,
546 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 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 569
      * Whether the local "raisedHand" flag is on.
550 570
      */
@@ -601,8 +621,15 @@ export default {
601 621
                     ConnectionEvents.CONNECTION_FAILED,
602 622
                     _connectionFailedHandler);
603 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 633
                 eventEmitter.emit(
607 634
                     JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
608 635
                     this.isDesktopSharingEnabled);

+ 4
- 1
config.js View File

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

+ 6
- 0
interface_config.js View File

@@ -2,6 +2,12 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars
2 2
     // TO FIX: this needs to be handled from SASS variables. There are some
3 3
     // methods allowing to use variables both in css and js.
4 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 11
     INITIAL_TOOLBAR_TIMEOUT: 20000,
6 12
     TOOLBAR_TIMEOUT: 4000,
7 13
     DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster",

+ 17
- 0
modules/UI/util/UIUtil.js View File

@@ -167,6 +167,23 @@ const IndicatorFontSizes = {
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 188
      * Removes the tooltip to the given element.
172 189
      *

+ 14
- 5
react/features/toolbox/actions.web.js View File

@@ -235,13 +235,22 @@ export function setProfileButtonUnclickable(unclickable: boolean): Function {
235 235
 export function showDesktopSharingButton(): Function {
236 236
     return (dispatch: Dispatch<*>) => {
237 237
         const buttonName = 'desktop';
238
+        const disabledTooltipText
239
+            = APP.conference.desktopSharingDisabledTooltip;
240
+        const showTooltip
241
+            = disabledTooltipText
242
+                && APP.conference.isDesktopSharingDisabledByConfig;
238 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 View File

@@ -221,9 +221,15 @@ class ToolbarButton extends AbstractToolbarButton {
221 221
         if (UIUtil.isButtonEnabled(name)) {
222 222
 
223 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 235
             if (button.shortcut) {

+ 4
- 0
react/features/toolbox/functions.web.js View File

@@ -43,6 +43,10 @@ export function getButtonAttributesByProps(props: Object = {})
43 43
         result.style = { display: 'none' };
44 44
     }
45 45
 
46
+    if (props.tooltipText) {
47
+        result.content = props.tooltipText;
48
+    }
49
+
46 50
     return result;
47 51
 }
48 52
 

Loading…
Cancel
Save