Przeglądaj źródła

ref: use getCurrentConference

Try to use the getCurrentConference function wherever the indention is
to check for the current conference.
master
paweldomas 7 lat temu
rodzic
commit
dbd1091364

+ 3
- 2
react/features/base/conference/actions.js Wyświetl plik

@@ -49,6 +49,7 @@ import {
49 49
 } from './constants';
50 50
 import {
51 51
     _addLocalTracksToConference,
52
+    getCurrentConference,
52 53
     sendLocalParticipant
53 54
 } from './functions';
54 55
 
@@ -643,9 +644,9 @@ export function setRoom(room: ?string) {
643 644
 export function setStartMutedPolicy(
644 645
         startAudioMuted: boolean, startVideoMuted: boolean) {
645 646
     return (dispatch: Dispatch<*>, getState: Function) => {
646
-        const { conference } = getState()['features/base/conference'];
647
+        const conference = getCurrentConference(getState());
647 648
 
648
-        conference.setStartMutedPolicy({
649
+        conference && conference.setStartMutedPolicy({
649 650
             audio: startAudioMuted,
650 651
             video: startVideoMuted
651 652
         });

+ 6
- 3
react/features/base/connection/actions.native.js Wyświetl plik

@@ -3,7 +3,11 @@
3 3
 import _ from 'lodash';
4 4
 import type { Dispatch } from 'redux';
5 5
 
6
-import { conferenceLeft, conferenceWillLeave } from '../conference';
6
+import {
7
+    conferenceLeft,
8
+    conferenceWillLeave,
9
+    getCurrentConference
10
+} from '../conference';
7 11
 import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet';
8 12
 import { parseStandardURIString } from '../util';
9 13
 
@@ -306,10 +310,9 @@ function _constructOptions(state) {
306 310
 export function disconnect() {
307 311
     return (dispatch: Dispatch<*>, getState: Function): Promise<void> => {
308 312
         const state = getState();
309
-        const { conference, joining } = state['features/base/conference'];
310 313
 
311 314
         // The conference we have already joined or are joining.
312
-        const conference_ = conference || joining;
315
+        const conference_ = getCurrentConference(state);
313 316
 
314 317
         // Promise which completes when the conference has been left and the
315 318
         // connection has been disconnected.

+ 6
- 6
react/features/base/participants/middleware.js Wyświetl plik

@@ -1,7 +1,11 @@
1 1
 // @flow
2 2
 
3 3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
4
-import { CONFERENCE_WILL_JOIN, forEachConference } from '../conference';
4
+import {
5
+    CONFERENCE_WILL_JOIN,
6
+    forEachConference,
7
+    getCurrentConference
8
+} from '../conference';
5 9
 import { CALLING, INVITED } from '../../presence-status';
6 10
 import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
7 11
 import UIEvents from '../../../../service/UI/UIEvents';
@@ -129,11 +133,7 @@ MiddlewareRegistry.register(store => next => action => {
129 133
  * with multiplying thumbnails in the filmstrip.
130 134
  */
131 135
 StateListenerRegistry.register(
132
-    /* selector */ state => {
133
-        const { conference, joining } = state['features/base/conference'];
134
-
135
-        return conference || joining;
136
-    },
136
+    /* selector */ state => getCurrentConference(state),
137 137
     /* listener */ (conference, { dispatch, getState }) => {
138 138
         for (const p of getState()['features/base/participants']) {
139 139
             !p.local

+ 8
- 7
react/features/mobile/full-screen/middleware.js Wyświetl plik

@@ -9,7 +9,8 @@ import {
9 9
     CONFERENCE_JOINED,
10 10
     CONFERENCE_LEFT,
11 11
     CONFERENCE_WILL_JOIN,
12
-    SET_AUDIO_ONLY
12
+    SET_AUDIO_ONLY,
13
+    getCurrentConference
13 14
 } from '../../base/conference';
14 15
 import { Platform } from '../../base/react';
15 16
 import { MiddlewareRegistry } from '../../base/redux';
@@ -50,10 +51,10 @@ MiddlewareRegistry.register(store => next => action => {
50 51
     case CONFERENCE_JOINED:
51 52
     case SET_AUDIO_ONLY: {
52 53
         const result = next(action);
53
-        const { audioOnly, conference, joining }
54
-            = store.getState()['features/base/conference'];
54
+        const { audioOnly } = store.getState()['features/base/conference'];
55
+        const conference = getCurrentConference(store);
55 56
 
56
-        _setFullScreen(conference || joining ? !audioOnly : false);
57
+        _setFullScreen(conference ? !audioOnly : false);
57 58
 
58 59
         return result;
59 60
     }
@@ -85,9 +86,9 @@ function _onImmersiveChange({ getState }) {
85 86
     const { appState } = state['features/background'];
86 87
 
87 88
     if (appState === 'active') {
88
-        const { audioOnly, conference, joining }
89
-            = state['features/base/conference'];
90
-        const fullScreen = conference || joining ? !audioOnly : false;
89
+        const { audioOnly } = state['features/base/conference'];
90
+        const conference = getCurrentConference(state);
91
+        const fullScreen = conference ? !audioOnly : false;
91 92
 
92 93
         _setFullScreen(fullScreen);
93 94
     }

Ładowanie…
Anuluj
Zapisz