ref: use getCurrentConference

Try to use the getCurrentConference function wherever the indention is
to check for the current conference.
This commit is contained in:
paweldomas 2018-05-24 15:15:32 -05:00 committed by Saúl Ibarra Corretgé
parent acc41e6d0b
commit dbd1091364
4 changed files with 23 additions and 18 deletions

View File

@ -49,6 +49,7 @@ import {
} from './constants';
import {
_addLocalTracksToConference,
getCurrentConference,
sendLocalParticipant
} from './functions';
@ -643,9 +644,9 @@ export function setRoom(room: ?string) {
export function setStartMutedPolicy(
startAudioMuted: boolean, startVideoMuted: boolean) {
return (dispatch: Dispatch<*>, getState: Function) => {
const { conference } = getState()['features/base/conference'];
const conference = getCurrentConference(getState());
conference.setStartMutedPolicy({
conference && conference.setStartMutedPolicy({
audio: startAudioMuted,
video: startVideoMuted
});

View File

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

View File

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

View File

@ -9,7 +9,8 @@ import {
CONFERENCE_JOINED,
CONFERENCE_LEFT,
CONFERENCE_WILL_JOIN,
SET_AUDIO_ONLY
SET_AUDIO_ONLY,
getCurrentConference
} from '../../base/conference';
import { Platform } from '../../base/react';
import { MiddlewareRegistry } from '../../base/redux';
@ -50,10 +51,10 @@ MiddlewareRegistry.register(store => next => action => {
case CONFERENCE_JOINED:
case SET_AUDIO_ONLY: {
const result = next(action);
const { audioOnly, conference, joining }
= store.getState()['features/base/conference'];
const { audioOnly } = store.getState()['features/base/conference'];
const conference = getCurrentConference(store);
_setFullScreen(conference || joining ? !audioOnly : false);
_setFullScreen(conference ? !audioOnly : false);
return result;
}
@ -85,9 +86,9 @@ function _onImmersiveChange({ getState }) {
const { appState } = state['features/background'];
if (appState === 'active') {
const { audioOnly, conference, joining }
= state['features/base/conference'];
const fullScreen = conference || joining ? !audioOnly : false;
const { audioOnly } = state['features/base/conference'];
const conference = getCurrentConference(state);
const fullScreen = conference ? !audioOnly : false;
_setFullScreen(fullScreen);
}