2018-05-10 04:45:24 +00:00
|
|
|
// @flow
|
2017-09-01 04:13:59 +00:00
|
|
|
|
2018-05-10 04:45:24 +00:00
|
|
|
import { getAppProp } from '../app';
|
2017-09-01 04:13:59 +00:00
|
|
|
import { toState } from '../base/redux';
|
|
|
|
|
|
|
|
declare var APP: Object;
|
|
|
|
declare var config: Object;
|
|
|
|
|
|
|
|
export * from './roomnameGenerator';
|
|
|
|
|
|
|
|
/**
|
2017-10-01 06:35:19 +00:00
|
|
|
* Determines whether the {@code WelcomePage} is enabled by the app itself
|
2017-09-01 04:13:59 +00:00
|
|
|
* (e.g. programmatically via the Jitsi Meet SDK for Android and iOS). Not to be
|
|
|
|
* 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
|
|
|
let b;
|
|
|
|
|
|
|
|
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).
|
2018-05-10 04:45:24 +00:00
|
|
|
b = Boolean(getAppProp(stateful, 'welcomePageEnabled'));
|
2017-09-01 04:13:59 +00:00
|
|
|
} else {
|
|
|
|
b = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
}
|