Переглянути джерело

fix(conference) remove no longer needed code

There is no need for setting the availability of desktop sharing anymore. It can
now be detected on the spot.

The reson for the previous code was that way back when browser extensions were
needed, it was possible to start a conference without desktopo sharing support
and get it afterwards. This is no longer the case.
master
Saúl Ibarra Corretgé 4 роки тому
джерело
коміт
2a01d3550c

+ 0
- 7
ConferenceEvents.js Переглянути файл

2
  * Notifies interested parties that hangup procedure will start.
2
  * Notifies interested parties that hangup procedure will start.
3
  */
3
  */
4
 export const BEFORE_HANGUP = 'conference.before_hangup';
4
 export const BEFORE_HANGUP = 'conference.before_hangup';
5
-
6
-/**
7
- * Notifies interested parties that desktop sharing enable/disable state is
8
- * changed.
9
- */
10
-export const DESKTOP_SHARING_ENABLED_CHANGED
11
-    = 'conference.desktop_sharing_enabled_changed';

+ 4
- 23
conference.js Переглянути файл

41
     lockStateChanged,
41
     lockStateChanged,
42
     onStartMutedPolicyChanged,
42
     onStartMutedPolicyChanged,
43
     p2pStatusChanged,
43
     p2pStatusChanged,
44
-    sendLocalParticipant,
45
-    setDesktopSharingEnabled
44
+    sendLocalParticipant
46
 } from './react/features/base/conference';
45
 } from './react/features/base/conference';
47
 import {
46
 import {
48
     checkAndNotifyForNewDevice,
47
     checkAndNotifyForNewDevice,
441
      * the tracks won't exist).
440
      * the tracks won't exist).
442
      */
441
      */
443
     _localTracksInitialized: false,
442
     _localTracksInitialized: false,
444
-    isSharingScreen: false,
445
 
443
 
446
-    /**
447
-     * Indicates if the desktop sharing functionality has been enabled.
448
-     * It takes into consideration the status returned by
449
-     * {@link JitsiMeetJS.isDesktopSharingEnabled()}. The latter can be false
450
-     * either if the desktop sharing is not supported by the current browser
451
-     * or if it was disabled through lib-jitsi-meet specific options (check
452
-     * config.js for listed options).
453
-     */
454
-    isDesktopSharingEnabled: false,
444
+    isSharingScreen: false,
455
 
445
 
456
     /**
446
     /**
457
      * The local audio track (if any).
447
      * The local audio track (if any).
679
         con.addEventListener(JitsiConnectionEvents.CONNECTION_FAILED, _connectionFailedHandler);
669
         con.addEventListener(JitsiConnectionEvents.CONNECTION_FAILED, _connectionFailedHandler);
680
         APP.connection = connection = con;
670
         APP.connection = connection = con;
681
 
671
 
682
-        // Desktop sharing related stuff:
683
-        this.isDesktopSharingEnabled
684
-            = JitsiMeetJS.isDesktopSharingEnabled();
685
-        eventEmitter.emit(JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED, this.isDesktopSharingEnabled);
686
-
687
-        APP.store.dispatch(
688
-            setDesktopSharingEnabled(this.isDesktopSharingEnabled));
689
-
690
         this._createRoom(tracks);
672
         this._createRoom(tracks);
691
         APP.remoteControl.init();
673
         APP.remoteControl.init();
692
 
674
 
1532
         if (this.videoSwitchInProgress) {
1514
         if (this.videoSwitchInProgress) {
1533
             return Promise.reject('Switch in progress.');
1515
             return Promise.reject('Switch in progress.');
1534
         }
1516
         }
1535
-        if (!this.isDesktopSharingEnabled) {
1536
-            return Promise.reject(
1537
-                'Cannot toggle screen sharing: not supported.');
1517
+        if (!JitsiMeetJS.isDesktopSharingEnabled()) {
1518
+            return Promise.reject('Cannot toggle screen sharing: not supported.');
1538
         }
1519
         }
1539
 
1520
 
1540
         if (this.isAudioOnly()) {
1521
         if (this.isAudioOnly()) {

+ 5
- 36
modules/API/API.js Переглянути файл

2
 
2
 
3
 import Logger from 'jitsi-meet-logger';
3
 import Logger from 'jitsi-meet-logger';
4
 
4
 
5
-import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
6
 import {
5
 import {
7
     createApiEvent,
6
     createApiEvent,
8
     sendAnalytics
7
     sendAnalytics
14
     setSubject
13
     setSubject
15
 } from '../../react/features/base/conference';
14
 } from '../../react/features/base/conference';
16
 import { parseJWTFromURLParams } from '../../react/features/base/jwt';
15
 import { parseJWTFromURLParams } from '../../react/features/base/jwt';
17
-import { JitsiRecordingConstants } from '../../react/features/base/lib-jitsi-meet';
16
+import JitsiMeetJS, { JitsiRecordingConstants } from '../../react/features/base/lib-jitsi-meet';
18
 import { pinParticipant } from '../../react/features/base/participants';
17
 import { pinParticipant } from '../../react/features/base/participants';
19
 import {
18
 import {
20
     processExternalDeviceRequest
19
     processExternalDeviceRequest
46
  */
45
  */
47
 let commands = {};
46
 let commands = {};
48
 
47
 
49
-/**
50
- * The state of screen sharing(started/stopped) before the screen sharing is
51
- * enabled and initialized.
52
- * NOTE: This flag help us to cache the state and use it if toggle-share-screen
53
- * was received before the initialization.
54
- */
55
-let initialScreenSharingState = false;
56
-
57
 /**
48
 /**
58
  * The transport instance used for communication with external apps.
49
  * The transport instance used for communication with external apps.
59
  *
50
  *
430
     });
421
     });
431
 }
422
 }
432
 
423
 
433
-/**
434
- * Listens for desktop/screen sharing enabled events and toggles the screen
435
- * sharing if needed.
436
- *
437
- * @param {boolean} enabled - Current screen sharing enabled status.
438
- * @returns {void}
439
- */
440
-function onDesktopSharingEnabledChanged(enabled = false) {
441
-    if (enabled && initialScreenSharingState) {
442
-        toggleScreenSharing();
443
-    }
444
-}
445
-
446
 /**
424
 /**
447
  * Check whether the API should be enabled or not.
425
  * Check whether the API should be enabled or not.
448
  *
426
  *
470
  * @returns {void}
448
  * @returns {void}
471
  */
449
  */
472
 function toggleScreenSharing(enable) {
450
 function toggleScreenSharing(enable) {
473
-    if (APP.conference.isDesktopSharingEnabled) {
474
-
475
-        // eslint-disable-next-line no-empty-function
476
-        APP.conference.toggleScreenSharing(enable).catch(() => {});
477
-    } else {
478
-        initialScreenSharingState = !initialScreenSharingState;
451
+    if (JitsiMeetJS.isDesktopSharingEnabled()) {
452
+        APP.conference.toggleScreenSharing(enable).catch(() => {
453
+            logger.warn('Failed to toggle screen-sharing');
454
+        });
479
     }
455
     }
480
 }
456
 }
481
 
457
 
508
          */
484
          */
509
         this._enabled = true;
485
         this._enabled = true;
510
 
486
 
511
-        APP.conference.addListener(
512
-            JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
513
-            onDesktopSharingEnabledChanged);
514
-
515
         initCommands();
487
         initCommands();
516
     }
488
     }
517
 
489
 
1058
     dispose() {
1030
     dispose() {
1059
         if (this._enabled) {
1031
         if (this._enabled) {
1060
             this._enabled = false;
1032
             this._enabled = false;
1061
-            APP.conference.removeListener(
1062
-                JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
1063
-                onDesktopSharingEnabledChanged);
1064
         }
1033
         }
1065
     }
1034
     }
1066
 }
1035
 }

+ 2
- 3
modules/remotecontrol/RemoteControl.js Переглянути файл

3
 import EventEmitter from 'events';
3
 import EventEmitter from 'events';
4
 import { getLogger } from 'jitsi-meet-logger';
4
 import { getLogger } from 'jitsi-meet-logger';
5
 
5
 
6
+import JitsiMeetJS from '../../react/features/base/lib-jitsi-meet';
6
 import { DISCO_REMOTE_CONTROL_FEATURE }
7
 import { DISCO_REMOTE_CONTROL_FEATURE }
7
     from '../../service/remotecontrol/Constants';
8
     from '../../service/remotecontrol/Constants';
8
 import * as RemoteControlEvents
9
 import * as RemoteControlEvents
68
      * @returns {void}
69
      * @returns {void}
69
      */
70
      */
70
     init() {
71
     init() {
71
-        if (config.disableRemoteControl
72
-                || this._initialized
73
-                || !APP.conference.isDesktopSharingEnabled) {
72
+        if (config.disableRemoteControl || this._initialized || !JitsiMeetJS.isDesktopSharingEnabled()) {
74
             return;
73
             return;
75
         }
74
         }
76
         logger.log('Initializing remote control.');
75
         logger.log('Initializing remote control.');

+ 0
- 12
react/features/base/conference/actionTypes.js Переглянути файл

140
  */
140
  */
141
 export const SEND_TONES = 'SEND_TONES';
141
 export const SEND_TONES = 'SEND_TONES';
142
 
142
 
143
-/**
144
- * The type of (redux) action which sets the desktop sharing enabled flag for
145
- * the current conference.
146
- *
147
- * {
148
- *     type: SET_DESKTOP_SHARING_ENABLED,
149
- *     desktopSharingEnabled: boolean
150
- * }
151
- */
152
-export const SET_DESKTOP_SHARING_ENABLED
153
-    = 'SET_DESKTOP_SHARING_ENABLED';
154
-
155
 /**
143
 /**
156
  * The type of (redux) action which updates the current known status of the
144
  * The type of (redux) action which updates the current known status of the
157
  * Follow Me feature.
145
  * Follow Me feature.

+ 0
- 17
react/features/base/conference/actions.js Переглянути файл

43
     LOCK_STATE_CHANGED,
43
     LOCK_STATE_CHANGED,
44
     P2P_STATUS_CHANGED,
44
     P2P_STATUS_CHANGED,
45
     SEND_TONES,
45
     SEND_TONES,
46
-    SET_DESKTOP_SHARING_ENABLED,
47
     SET_FOLLOW_ME,
46
     SET_FOLLOW_ME,
48
     SET_PASSWORD,
47
     SET_PASSWORD,
49
     SET_PASSWORD_FAILED,
48
     SET_PASSWORD_FAILED,
573
     };
572
     };
574
 }
573
 }
575
 
574
 
576
-/**
577
- * Sets the flag for indicating if desktop sharing is enabled.
578
- *
579
- * @param {boolean} desktopSharingEnabled - True if desktop sharing is enabled.
580
- * @returns {{
581
- *     type: SET_DESKTOP_SHARING_ENABLED,
582
- *     desktopSharingEnabled: boolean
583
- * }}
584
- */
585
-export function setDesktopSharingEnabled(desktopSharingEnabled: boolean) {
586
-    return {
587
-        type: SET_DESKTOP_SHARING_ENABLED,
588
-        desktopSharingEnabled
589
-    };
590
-}
591
-
592
 /**
575
 /**
593
  * Enables or disables the Follow Me feature.
576
  * Enables or disables the Follow Me feature.
594
  *
577
  *

+ 0
- 19
react/features/base/conference/reducer.js Переглянути файл

16
     CONFERENCE_WILL_LEAVE,
16
     CONFERENCE_WILL_LEAVE,
17
     LOCK_STATE_CHANGED,
17
     LOCK_STATE_CHANGED,
18
     P2P_STATUS_CHANGED,
18
     P2P_STATUS_CHANGED,
19
-    SET_DESKTOP_SHARING_ENABLED,
20
     SET_FOLLOW_ME,
19
     SET_FOLLOW_ME,
21
     SET_PASSWORD,
20
     SET_PASSWORD,
22
     SET_PENDING_SUBJECT_CHANGE,
21
     SET_PENDING_SUBJECT_CHANGE,
76
         case P2P_STATUS_CHANGED:
75
         case P2P_STATUS_CHANGED:
77
             return _p2pStatusChanged(state, action);
76
             return _p2pStatusChanged(state, action);
78
 
77
 
79
-        case SET_DESKTOP_SHARING_ENABLED:
80
-            return _setDesktopSharingEnabled(state, action);
81
-
82
         case SET_FOLLOW_ME:
78
         case SET_FOLLOW_ME:
83
             return set(state, 'followMeEnabled', action.enabled);
79
             return set(state, 'followMeEnabled', action.enabled);
84
 
80
 
343
     return set(state, 'p2p', action.p2p);
339
     return set(state, 'p2p', action.p2p);
344
 }
340
 }
345
 
341
 
346
-/**
347
- * Reduces a specific Redux action SET_DESKTOP_SHARING_ENABLED of the feature
348
- * base/conference.
349
- *
350
- * @param {Object} state - The Redux state of the feature base/conference.
351
- * @param {Action} action - The Redux action SET_DESKTOP_SHARING_ENABLED to
352
- * reduce.
353
- * @private
354
- * @returns {Object} The new state of the feature base/conference after the
355
- * reduction of the specified action.
356
- */
357
-function _setDesktopSharingEnabled(state, action) {
358
-    return set(state, 'desktopSharingEnabled', action.desktopSharingEnabled);
359
-}
360
-
361
 /**
342
 /**
362
  * Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
343
  * Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
363
  *
344
  *

+ 2
- 1
react/features/toolbox/components/web/Toolbox.js Переглянути файл

25
     IconShareDesktop,
25
     IconShareDesktop,
26
     IconShareVideo
26
     IconShareVideo
27
 } from '../../../base/icons';
27
 } from '../../../base/icons';
28
+import JitsiMeetJS from '../../../base/lib-jitsi-meet';
28
 import {
29
 import {
29
     getLocalParticipant,
30
     getLocalParticipant,
30
     getParticipants,
31
     getParticipants,
1403
  */
1404
  */
1404
 function _mapStateToProps(state) {
1405
 function _mapStateToProps(state) {
1405
     const { conference, locked } = state['features/base/conference'];
1406
     const { conference, locked } = state['features/base/conference'];
1406
-    let { desktopSharingEnabled } = state['features/base/conference'];
1407
+    let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
1407
     const {
1408
     const {
1408
         callStatsID,
1409
         callStatsID,
1409
         enableFeaturesBasedOnToken
1410
         enableFeaturesBasedOnToken

Завантаження…
Відмінити
Зберегти