2022-09-14 07:54:56 +00:00
|
|
|
import { IStore } from '../../app/types';
|
|
|
|
import { configureInitialDevices } from '../devices/actions';
|
|
|
|
import { getBackendSafeRoomName } from '../util/uri';
|
2017-02-03 18:50:06 +00:00
|
|
|
|
2017-01-31 20:58:48 +00:00
|
|
|
export {
|
2020-04-15 13:13:43 +00:00
|
|
|
connectionDisconnected,
|
2017-01-31 20:58:48 +00:00
|
|
|
connectionEstablished,
|
2017-05-09 05:15:43 +00:00
|
|
|
connectionFailed,
|
|
|
|
setLocationURL
|
2022-10-18 16:21:48 +00:00
|
|
|
} from './actions.any';
|
2019-08-21 14:50:00 +00:00
|
|
|
import logger from './logger';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
2022-06-16 12:27:41 +00:00
|
|
|
export * from './actions.any';
|
|
|
|
|
2016-12-12 21:13:17 +00:00
|
|
|
/**
|
|
|
|
* Opens new connection.
|
|
|
|
*
|
|
|
|
* @returns {Promise<JitsiConnection>}
|
|
|
|
*/
|
|
|
|
export function connect() {
|
2022-09-14 07:54:56 +00:00
|
|
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
2019-10-04 07:31:22 +00:00
|
|
|
const room = getBackendSafeRoomName(getState()['features/base/conference'].room);
|
2016-12-12 21:13:17 +00:00
|
|
|
|
|
|
|
// XXX For web based version we use conference initialization logic
|
|
|
|
// from the old app (at the moment of writing).
|
2019-03-25 11:33:41 +00:00
|
|
|
return dispatch(configureInitialDevices()).then(
|
|
|
|
() => APP.conference.init({
|
|
|
|
roomName: room
|
2022-09-14 07:54:56 +00:00
|
|
|
}).catch((error: Error) => {
|
2019-03-25 11:33:41 +00:00
|
|
|
APP.API.notifyConferenceLeft(APP.conference.roomName);
|
|
|
|
logger.error(error);
|
|
|
|
}));
|
2016-12-12 21:13:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes connection.
|
|
|
|
*
|
2018-03-07 00:28:19 +00:00
|
|
|
* @param {boolean} [requestFeedback] - Whether or not to attempt showing a
|
|
|
|
* request for call feedback.
|
2016-12-12 21:13:17 +00:00
|
|
|
* @returns {Function}
|
|
|
|
*/
|
2022-09-14 07:54:56 +00:00
|
|
|
export function disconnect(requestFeedback = false) {
|
2017-01-10 21:55:31 +00:00
|
|
|
// XXX For web based version we use conference hanging up logic from the old
|
|
|
|
// app.
|
2018-03-07 00:28:19 +00:00
|
|
|
return () => APP.conference.hangup(requestFeedback);
|
2016-12-12 21:13:17 +00:00
|
|
|
}
|