浏览代码

ref: use getCurrentConference

Try to use the getCurrentConference function wherever the indention is
to check for the current conference.
master
paweldomas 7 年前
父节点
当前提交
dbd1091364

+ 3
- 2
react/features/base/conference/actions.js 查看文件

49
 } from './constants';
49
 } from './constants';
50
 import {
50
 import {
51
     _addLocalTracksToConference,
51
     _addLocalTracksToConference,
52
+    getCurrentConference,
52
     sendLocalParticipant
53
     sendLocalParticipant
53
 } from './functions';
54
 } from './functions';
54
 
55
 
643
 export function setStartMutedPolicy(
644
 export function setStartMutedPolicy(
644
         startAudioMuted: boolean, startVideoMuted: boolean) {
645
         startAudioMuted: boolean, startVideoMuted: boolean) {
645
     return (dispatch: Dispatch<*>, getState: Function) => {
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
             audio: startAudioMuted,
650
             audio: startAudioMuted,
650
             video: startVideoMuted
651
             video: startVideoMuted
651
         });
652
         });

+ 6
- 3
react/features/base/connection/actions.native.js 查看文件

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

+ 6
- 6
react/features/base/participants/middleware.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
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
 import { CALLING, INVITED } from '../../presence-status';
9
 import { CALLING, INVITED } from '../../presence-status';
6
 import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
10
 import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
7
 import UIEvents from '../../../../service/UI/UIEvents';
11
 import UIEvents from '../../../../service/UI/UIEvents';
129
  * with multiplying thumbnails in the filmstrip.
133
  * with multiplying thumbnails in the filmstrip.
130
  */
134
  */
131
 StateListenerRegistry.register(
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
     /* listener */ (conference, { dispatch, getState }) => {
137
     /* listener */ (conference, { dispatch, getState }) => {
138
         for (const p of getState()['features/base/participants']) {
138
         for (const p of getState()['features/base/participants']) {
139
             !p.local
139
             !p.local

+ 8
- 7
react/features/mobile/full-screen/middleware.js 查看文件

9
     CONFERENCE_JOINED,
9
     CONFERENCE_JOINED,
10
     CONFERENCE_LEFT,
10
     CONFERENCE_LEFT,
11
     CONFERENCE_WILL_JOIN,
11
     CONFERENCE_WILL_JOIN,
12
-    SET_AUDIO_ONLY
12
+    SET_AUDIO_ONLY,
13
+    getCurrentConference
13
 } from '../../base/conference';
14
 } from '../../base/conference';
14
 import { Platform } from '../../base/react';
15
 import { Platform } from '../../base/react';
15
 import { MiddlewareRegistry } from '../../base/redux';
16
 import { MiddlewareRegistry } from '../../base/redux';
50
     case CONFERENCE_JOINED:
51
     case CONFERENCE_JOINED:
51
     case SET_AUDIO_ONLY: {
52
     case SET_AUDIO_ONLY: {
52
         const result = next(action);
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
         return result;
59
         return result;
59
     }
60
     }
85
     const { appState } = state['features/background'];
86
     const { appState } = state['features/background'];
86
 
87
 
87
     if (appState === 'active') {
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
         _setFullScreen(fullScreen);
93
         _setFullScreen(fullScreen);
93
     }
94
     }

正在加载...
取消
保存