Просмотр исходного кода

fix(toolbox) Disable screensharing button on mobile for video sender limit.

Also, ignore the toggle screenshare shortcut when the video sender limit is reached.
master
Jaya Allamsetty 3 лет назад
Родитель
Сommit
29eb9452c0

+ 2
- 1
react/features/toolbox/components/native/ScreenSharingButton.js Просмотреть файл

@@ -4,6 +4,7 @@ import React from 'react';
4 4
 import { Platform } from 'react-native';
5 5
 
6 6
 import { connect } from '../../../base/redux';
7
+import { isDesktopShareButtonDisabled } from '../../functions';
7 8
 
8 9
 import ScreenSharingAndroidButton from './ScreenSharingAndroidButton.js';
9 10
 import ScreenSharingIosButton from './ScreenSharingIosButton.js';
@@ -30,7 +31,7 @@ const ScreenSharingButton = props => (
30 31
  * }}
31 32
  */
32 33
 function _mapStateToProps(state): Object {
33
-    const disabled = state['features/base/audio-only'].enabled;
34
+    const disabled = state['features/base/audio-only'].enabled || isDesktopShareButtonDisabled(state);
34 35
 
35 36
     return {
36 37
         _disabled: disabled

+ 7
- 9
react/features/toolbox/components/web/ShareDesktopButton.js Просмотреть файл

@@ -5,7 +5,8 @@ import { IconShareDesktop } from '../../../base/icons';
5 5
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
6 6
 import { connect } from '../../../base/redux';
7 7
 import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
8
-import { isScreenMediaShared, isScreenVideoShared } from '../../../screen-share';
8
+import { isScreenVideoShared } from '../../../screen-share';
9
+import { isDesktopShareButtonDisabled } from '../../functions';
9 10
 
10 11
 type Props = AbstractButtonProps & {
11 12
 
@@ -97,15 +98,8 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
97 98
  * @returns {Object}
98 99
  */
99 100
 const mapStateToProps = state => {
100
-    const { muted, unmuteBlocked } = state['features/base/media'].video;
101
-    const videoOrShareInProgress = isScreenMediaShared(state) || !muted;
102
-
103
-    // Disable the screenshare button if the video sender limit is reached and there is no video or media share in
104
-    // progress.
105
-    let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled()
106
-        && !(unmuteBlocked && !videoOrShareInProgress);
101
+    let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
107 102
     const { enableFeaturesBasedOnToken } = state['features/base/config'];
108
-
109 103
     let desktopSharingDisabledTooltipKey;
110 104
 
111 105
     if (enableFeaturesBasedOnToken) {
@@ -115,6 +109,10 @@ const mapStateToProps = state => {
115 109
         desktopSharingDisabledTooltipKey = 'dialog.shareYourScreenDisabled';
116 110
     }
117 111
 
112
+    // Disable the screenshare button if the video sender limit is reached and there is no video or media share in
113
+    // progress.
114
+    desktopSharingEnabled = desktopSharingEnabled && !isDesktopShareButtonDisabled(state);
115
+
118 116
     return {
119 117
         _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
120 118
         _desktopSharingEnabled: desktopSharingEnabled,

+ 13
- 2
react/features/toolbox/components/web/Toolbox.js Просмотреть файл

@@ -77,7 +77,7 @@ import {
77 77
     showToolbox
78 78
 } from '../../actions';
79 79
 import { THRESHOLDS, NOT_APPLICABLE, DRAWER_MAX_HEIGHT, NOTIFY_CLICK_MODE } from '../../constants';
80
-import { isToolboxVisible } from '../../functions';
80
+import { isDesktopShareButtonDisabled, isToolboxVisible } from '../../functions';
81 81
 import DownloadButton from '../DownloadButton';
82 82
 import HangupButton from '../HangupButton';
83 83
 import HelpButton from '../HelpButton';
@@ -123,6 +123,11 @@ type Props = {
123 123
      */
124 124
     _conference: Object,
125 125
 
126
+    /**
127
+     * Whether or not screensharing button is disabled.
128
+     */
129
+    _desktopSharingButtonDisabled: boolean,
130
+
126 131
     /**
127 132
      * The tooltip key to use when screensharing is disabled. Or undefined
128 133
      * if non to be shown and the button to be hidden.
@@ -537,6 +542,7 @@ class Toolbox extends Component<Props> {
537 542
     _doToggleScreenshare() {
538 543
         const {
539 544
             _backgroundType,
545
+            _desktopSharingButtonDisabled,
540 546
             _desktopSharingEnabled,
541 547
             _localVideo,
542 548
             _virtualSource,
@@ -558,7 +564,7 @@ class Toolbox extends Component<Props> {
558 564
             return;
559 565
         }
560 566
 
561
-        if (_desktopSharingEnabled) {
567
+        if (_desktopSharingEnabled && !_desktopSharingButtonDisabled) {
562 568
             dispatch(startScreenShareFlow());
563 569
         }
564 570
     }
@@ -1059,6 +1065,10 @@ class Toolbox extends Component<Props> {
1059 1065
      * @returns {void}
1060 1066
      */
1061 1067
     _onShortcutToggleScreenshare() {
1068
+        // Ignore the shortcut if the button is disabled.
1069
+        if (this.props._desktopSharingButtonDisabled) {
1070
+            return;
1071
+        }
1062 1072
         sendAnalytics(createShortcutEvent(
1063 1073
                 'toggle.screen.sharing',
1064 1074
                 ACTION_SHORTCUT_TRIGGERED,
@@ -1377,6 +1387,7 @@ function _mapStateToProps(state, ownProps) {
1377 1387
         _clientWidth: clientWidth,
1378 1388
         _conference: conference,
1379 1389
         _desktopSharingEnabled: desktopSharingEnabled,
1390
+        _desktopSharingButtonDisabled: isDesktopShareButtonDisabled(state),
1380 1391
         _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
1381 1392
         _dialog: Boolean(state['features/base/dialog'].component),
1382 1393
         _feedbackConfigured: Boolean(callStatsID),

+ 13
- 0
react/features/toolbox/functions.native.js Просмотреть файл

@@ -53,6 +53,19 @@ export function getMovableButtons(width: number): Set<string> {
53 53
     return new Set(buttons);
54 54
 }
55 55
 
56
+/**
57
+ * Indicates if the desktop share button is disabled or not.
58
+ *
59
+ * @param {Object} state - The state from the Redux store.
60
+ * @returns {boolean}
61
+ */
62
+export function isDesktopShareButtonDisabled(state: Object) {
63
+    const { muted, unmuteBlocked } = state['features/base/media'].video;
64
+    const videoOrShareInProgress = !muted || isLocalVideoTrackDesktop(state);
65
+
66
+    return unmuteBlocked && !videoOrShareInProgress;
67
+}
68
+
56 69
 /**
57 70
  * Returns true if the toolbox is visible.
58 71
  *

+ 14
- 1
react/features/toolbox/functions.web.js Просмотреть файл

@@ -1,7 +1,7 @@
1 1
 // @flow
2
-
3 2
 import { getToolbarButtons } from '../base/config';
4 3
 import { hasAvailableDevices } from '../base/devices';
4
+import { isScreenMediaShared } from '../screen-share/functions';
5 5
 
6 6
 import { TOOLBAR_TIMEOUT } from './constants';
7 7
 
@@ -66,6 +66,19 @@ export function isAudioSettingsButtonDisabled(state: Object) {
66 66
           || state['features/base/config'].startSilent;
67 67
 }
68 68
 
69
+/**
70
+ * Indicates if the desktop share button is disabled or not.
71
+ *
72
+ * @param {Object} state - The state from the Redux store.
73
+ * @returns {boolean}
74
+ */
75
+export function isDesktopShareButtonDisabled(state: Object) {
76
+    const { muted, unmuteBlocked } = state['features/base/media'].video;
77
+    const videoOrShareInProgress = !muted || isScreenMediaShared(state);
78
+
79
+    return unmuteBlocked && !videoOrShareInProgress;
80
+}
81
+
69 82
 /**
70 83
  * Indicates if the video settings button is disabled or not.
71 84
  *

Загрузка…
Отмена
Сохранить