diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index 1a32d61a5..0f9abe049 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -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 }); diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js index 0c5216438..dd2ac8cd3 100644 --- a/react/features/base/connection/actions.native.js +++ b/react/features/base/connection/actions.native.js @@ -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 => { 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. diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js index 93210bab2..e49d9e0c4 100644 --- a/react/features/base/participants/middleware.js +++ b/react/features/base/participants/middleware.js @@ -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 diff --git a/react/features/mobile/full-screen/middleware.js b/react/features/mobile/full-screen/middleware.js index 3f2471646..4017273c8 100644 --- a/react/features/mobile/full-screen/middleware.js +++ b/react/features/mobile/full-screen/middleware.js @@ -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); }