fix(conference) simplify code
Unify the 2 functions used to leave the room into a single one.
This commit is contained in:
parent
599ed10325
commit
43647f1302
|
@ -9,6 +9,7 @@ import { ENDPOINT_TEXT_MESSAGE_NAME } from './modules/API/constants';
|
|||
import { AUDIO_ONLY_SCREEN_SHARE_NO_TRACK } from './modules/UI/UIErrors';
|
||||
import AuthHandler from './modules/UI/authentication/AuthHandler';
|
||||
import UIUtil from './modules/UI/util/UIUtil';
|
||||
import VideoLayout from './modules/UI/videolayout/VideoLayout';
|
||||
import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
|
||||
import Recorder from './modules/recorder/Recorder';
|
||||
import { createTaskQueue } from './modules/util/helpers';
|
||||
|
@ -1329,6 +1330,10 @@ export default {
|
|||
* Used by the Breakout Rooms feature to join a breakout room or go back to the main room.
|
||||
*/
|
||||
async joinRoom(roomName) {
|
||||
// Reset VideoLayout. It's destroyed in features/video-layout/middleware.web.js so re-initialize it.
|
||||
VideoLayout.initLargeVideo();
|
||||
VideoLayout.resizeVideoArea();
|
||||
|
||||
this.roomName = roomName;
|
||||
|
||||
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks();
|
||||
|
@ -2884,7 +2889,7 @@ export default {
|
|||
|
||||
Promise.all([
|
||||
requestFeedbackPromise,
|
||||
this.leaveRoomAndDisconnect()
|
||||
this.leaveRoom()
|
||||
])
|
||||
.then(values => {
|
||||
this._room = undefined;
|
||||
|
@ -2905,27 +2910,23 @@ export default {
|
|||
/**
|
||||
* Leaves the room.
|
||||
*
|
||||
* @param {boolean} doDisconnect - Wether leaving the room should also terminate the connection.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
leaveRoom() {
|
||||
if (room && room.isJoined()) {
|
||||
return room.leave();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Leaves the room and calls JitsiConnection.disconnect.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
leaveRoomAndDisconnect() {
|
||||
leaveRoom(doDisconnect = true) {
|
||||
APP.store.dispatch(conferenceWillLeave(room));
|
||||
|
||||
if (room && room.isJoined()) {
|
||||
return room.leave().then(disconnect, disconnect);
|
||||
return room.leave().finally(() => {
|
||||
if (doDisconnect) {
|
||||
return disconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (doDisconnect) {
|
||||
return disconnect();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -199,7 +199,7 @@ export function moveToRoom(roomId?: string) {
|
|||
dispatch(setAudioMuted(audio.muted));
|
||||
dispatch(setVideoMuted(video.muted));
|
||||
} else {
|
||||
APP.conference.leaveRoom()
|
||||
APP.conference.leaveRoom(false /* doDisconnect */)
|
||||
.finally(() => APP.conference.joinRoom(_roomId));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,8 +15,6 @@ import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from '../participants
|
|||
|
||||
import './middleware.any';
|
||||
|
||||
declare var APP: Object;
|
||||
|
||||
/**
|
||||
* Middleware which intercepts actions and updates the legacy component
|
||||
* {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify
|
||||
|
|
Loading…
Reference in New Issue