2018-03-07 00:28:19 +00:00
|
|
|
// @flow
|
2017-02-03 18:50:06 +00:00
|
|
|
|
|
|
|
import type { Dispatch } from 'redux';
|
2016-12-12 21:13:17 +00:00
|
|
|
|
2017-02-03 18:50:06 +00:00
|
|
|
declare var APP: Object;
|
2017-02-16 21:22:40 +00:00
|
|
|
declare var config: Object;
|
2017-02-03 18:50:06 +00:00
|
|
|
|
2017-01-10 21:55:31 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2016-12-12 21:13:17 +00:00
|
|
|
|
2017-01-31 20:58:48 +00:00
|
|
|
export {
|
|
|
|
connectionEstablished,
|
2017-05-09 05:15:43 +00:00
|
|
|
connectionFailed,
|
|
|
|
setLocationURL
|
2017-09-07 17:21:56 +00:00
|
|
|
} from './actions.native';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
2016-12-12 21:13:17 +00:00
|
|
|
/**
|
|
|
|
* Opens new connection.
|
|
|
|
*
|
|
|
|
* @returns {Promise<JitsiConnection>}
|
|
|
|
*/
|
|
|
|
export function connect() {
|
2017-02-03 18:50:06 +00:00
|
|
|
return (dispatch: Dispatch<*>, getState: Function) => {
|
2017-01-15 19:05:17 +00:00
|
|
|
// XXX Lib-jitsi-meet does not accept uppercase letters.
|
2018-07-12 03:57:44 +00:00
|
|
|
const room = getState()['features/base/conference'].room.toLowerCase();
|
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).
|
core: refactor routing
Unfortunately, as the Jitsi Meet development evolved the routing mechanism
became more complex and thre logic ended up spread across multiple parts of the
codebase, which made it hard to follow and extend.
This change aims to fix that by rewriting the routing logic and centralizing it
in (pretty much) a single place, with no implicit inter-dependencies.
In order to arrive there, however, some extra changes were needed, which were
not caught early enough and are thus part of this change:
- JitsiMeetJS initialization is now synchronous: there is nothing async about
it, and the only async requirement (Temasys support) was lifted. See [0].
- WebRTC support can be detected early: building on top of the above, WebRTC
support can now be detected immediately, so take advantage of this to simplify
how we handle unsupported browsers. See [0].
The new router takes decissions based on the Redux state at the time of
invocation. A route can be represented by either a component or a URl reference,
with the latter taking precedence. On mobile, obviously, there is no concept of
URL reference so routing is based solely on components.
[0]: https://github.com/jitsi/lib-jitsi-meet/pull/779
2018-06-29 07:58:31 +00:00
|
|
|
return APP.conference.init({
|
2018-04-16 12:44:08 +00:00
|
|
|
roomName: room
|
core: refactor routing
Unfortunately, as the Jitsi Meet development evolved the routing mechanism
became more complex and thre logic ended up spread across multiple parts of the
codebase, which made it hard to follow and extend.
This change aims to fix that by rewriting the routing logic and centralizing it
in (pretty much) a single place, with no implicit inter-dependencies.
In order to arrive there, however, some extra changes were needed, which were
not caught early enough and are thus part of this change:
- JitsiMeetJS initialization is now synchronous: there is nothing async about
it, and the only async requirement (Temasys support) was lifted. See [0].
- WebRTC support can be detected early: building on top of the above, WebRTC
support can now be detected immediately, so take advantage of this to simplify
how we handle unsupported browsers. See [0].
The new router takes decissions based on the Redux state at the time of
invocation. A route can be represented by either a component or a URl reference,
with the latter taking precedence. On mobile, obviously, there is no concept of
URL reference so routing is based solely on components.
[0]: https://github.com/jitsi/lib-jitsi-meet/pull/779
2018-06-29 07:58:31 +00:00
|
|
|
}).catch(error => {
|
2018-04-16 12:44:08 +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}
|
|
|
|
*/
|
2018-03-07 00:28:19 +00:00
|
|
|
export function disconnect(requestFeedback: boolean = 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
|
|
|
}
|