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 { AUDIO_ONLY_SCREEN_SHARE_NO_TRACK } from './modules/UI/UIErrors';
|
||||||
import AuthHandler from './modules/UI/authentication/AuthHandler';
|
import AuthHandler from './modules/UI/authentication/AuthHandler';
|
||||||
import UIUtil from './modules/UI/util/UIUtil';
|
import UIUtil from './modules/UI/util/UIUtil';
|
||||||
|
import VideoLayout from './modules/UI/videolayout/VideoLayout';
|
||||||
import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
|
import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
|
||||||
import Recorder from './modules/recorder/Recorder';
|
import Recorder from './modules/recorder/Recorder';
|
||||||
import { createTaskQueue } from './modules/util/helpers';
|
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.
|
* Used by the Breakout Rooms feature to join a breakout room or go back to the main room.
|
||||||
*/
|
*/
|
||||||
async joinRoom(roomName) {
|
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;
|
this.roomName = roomName;
|
||||||
|
|
||||||
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks();
|
const { tryCreateLocalTracks, errors } = this.createInitialLocalTracks();
|
||||||
|
@ -2884,7 +2889,7 @@ export default {
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
requestFeedbackPromise,
|
requestFeedbackPromise,
|
||||||
this.leaveRoomAndDisconnect()
|
this.leaveRoom()
|
||||||
])
|
])
|
||||||
.then(values => {
|
.then(values => {
|
||||||
this._room = undefined;
|
this._room = undefined;
|
||||||
|
@ -2905,27 +2910,23 @@ export default {
|
||||||
/**
|
/**
|
||||||
* Leaves the room.
|
* Leaves the room.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} doDisconnect - Wether leaving the room should also terminate the connection.
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
leaveRoom() {
|
leaveRoom(doDisconnect = true) {
|
||||||
if (room && room.isJoined()) {
|
|
||||||
return room.leave();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Leaves the room and calls JitsiConnection.disconnect.
|
|
||||||
*
|
|
||||||
* @returns {Promise}
|
|
||||||
*/
|
|
||||||
leaveRoomAndDisconnect() {
|
|
||||||
APP.store.dispatch(conferenceWillLeave(room));
|
APP.store.dispatch(conferenceWillLeave(room));
|
||||||
|
|
||||||
if (room && room.isJoined()) {
|
if (room && room.isJoined()) {
|
||||||
return room.leave().then(disconnect, disconnect);
|
return room.leave().finally(() => {
|
||||||
|
if (doDisconnect) {
|
||||||
|
return disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return disconnect();
|
if (doDisconnect) {
|
||||||
|
return disconnect();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -199,7 +199,7 @@ export function moveToRoom(roomId?: string) {
|
||||||
dispatch(setAudioMuted(audio.muted));
|
dispatch(setAudioMuted(audio.muted));
|
||||||
dispatch(setVideoMuted(video.muted));
|
dispatch(setVideoMuted(video.muted));
|
||||||
} else {
|
} else {
|
||||||
APP.conference.leaveRoom()
|
APP.conference.leaveRoom(false /* doDisconnect */)
|
||||||
.finally(() => APP.conference.joinRoom(_roomId));
|
.finally(() => APP.conference.joinRoom(_roomId));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,8 +15,6 @@ import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from '../participants
|
||||||
|
|
||||||
import './middleware.any';
|
import './middleware.any';
|
||||||
|
|
||||||
declare var APP: Object;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Middleware which intercepts actions and updates the legacy component
|
* Middleware which intercepts actions and updates the legacy component
|
||||||
* {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify
|
* {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify
|
||||||
|
|
Loading…
Reference in New Issue