2018-05-10 04:45:24 +00:00
|
|
|
// @flow
|
2017-09-01 04:13:59 +00:00
|
|
|
|
2019-05-24 11:06:05 +00:00
|
|
|
import { WELCOME_PAGE_ENABLED, getFeatureFlag } from '../base/flags';
|
2017-09-01 04:13:59 +00:00
|
|
|
import { toState } from '../base/redux';
|
|
|
|
|
|
|
|
declare var APP: Object;
|
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* Determines whether the {@code WelcomePage} is enabled by the app itself
|
2018-11-08 12:25:02 +00:00
|
|
|
* (e.g. Programmatically via the Jitsi Meet SDK for Android and iOS). Not to be
|
2017-09-01 04:13:59 +00:00
|
|
|
* confused with {@link isWelcomePageUserEnabled}.
|
|
|
|
*
|
2018-05-10 04:45:24 +00:00
|
|
|
* @param {Function|Object} stateful - The redux state or {@link getState}
|
|
|
|
* function.
|
2017-10-01 06:35:19 +00:00
|
|
|
* @returns {boolean} If the {@code WelcomePage} is enabled by the app, then
|
|
|
|
* {@code true}; otherwise, {@code false}.
|
2017-09-01 04:13:59 +00:00
|
|
|
*/
|
2018-05-10 04:45:24 +00:00
|
|
|
export function isWelcomePageAppEnabled(stateful: Function | Object) {
|
2017-09-01 04:13:59 +00:00
|
|
|
if (navigator.product === 'ReactNative') {
|
|
|
|
// We introduced the welcomePageEnabled prop on App in Jitsi Meet SDK
|
|
|
|
// for Android and iOS. There isn't a strong reason not to introduce it
|
|
|
|
// on Web but there're a few considerations to be taken before I go
|
|
|
|
// there among which:
|
|
|
|
// - Enabling/disabling the Welcome page on Web historically
|
|
|
|
// automatically redirects to a random room and that does not make sense
|
|
|
|
// on mobile (right now).
|
2019-05-24 11:06:05 +00:00
|
|
|
return Boolean(getFeatureFlag(stateful, WELCOME_PAGE_ENABLED));
|
2017-09-01 04:13:59 +00:00
|
|
|
}
|
|
|
|
|
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 true;
|
2017-09-01 04:13:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* Determines whether the {@code WelcomePage} is enabled by the user either
|
2017-09-01 04:13:59 +00:00
|
|
|
* herself or through her deployment config(uration). Not to be confused with
|
|
|
|
* {@link isWelcomePageAppEnabled}.
|
|
|
|
*
|
2018-05-10 04:45:24 +00:00
|
|
|
* @param {Function|Object} stateful - The redux state or {@link getState}
|
|
|
|
* function.
|
2017-10-01 06:35:19 +00:00
|
|
|
* @returns {boolean} If the {@code WelcomePage} is enabled by the user, then
|
|
|
|
* {@code true}; otherwise, {@code false}.
|
2017-09-01 04:13:59 +00:00
|
|
|
*/
|
2018-05-10 04:45:24 +00:00
|
|
|
export function isWelcomePageUserEnabled(stateful: Function | Object) {
|
2017-09-01 04:13:59 +00:00
|
|
|
return (
|
|
|
|
typeof APP === 'undefined'
|
|
|
|
? true
|
2018-05-10 04:45:24 +00:00
|
|
|
: toState(stateful)['features/base/config'].enableWelcomePage);
|
2017-09-01 04:13:59 +00:00
|
|
|
}
|