Files
jitsi-meet/react/features/welcome/functions.js
Lyubo Marinov 4bf19d73fd [RN] Fix documentation comments
* Javadoc introduced @code as a replacement of <code> and <tt> which is
  better aligned with other javadoc tags such as @link. Use it in the
  Java source code. If we switch to Kotlin, then we'll definitely use
  Markdown.

* There are more uses of @code in the JavaScript source code than <tt>
  so use @code for the sake of consistency. Eventually, I'd rather we
  switch to Markdown because it's easier on my eyes.

* Xcode is plain confused by @code and @link. The Internet says that
  Xcode supports the backquote character to denote the beginning and end
  of a string of characters which should be formatted for display as
  code but it doesn't work for me. <tt> is not rendered at all. So use
  the backquote which is rendered itself. Hopefully, if we switch to
  Markdown, then it'll be common between JavaScript and Objective-C
  source code.
2017-10-01 01:35:19 -05:00

58 lines
2.0 KiB
JavaScript

/* @flow */
import { toState } from '../base/redux';
declare var APP: Object;
declare var config: Object;
export * from './roomnameGenerator';
/**
* Determines whether the {@code WelcomePage} is enabled by the app itself
* (e.g. programmatically via the Jitsi Meet SDK for Android and iOS). Not to be
* confused with {@link isWelcomePageUserEnabled}.
*
* @param {Object|Function} stateOrGetState - The redux state or
* {@link getState} function.
* @returns {boolean} If the {@code WelcomePage} is enabled by the app, then
* {@code true}; otherwise, {@code false}.
*/
export function isWelcomePageAppEnabled(stateOrGetState: Object | Function) {
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).
const { app } = toState(stateOrGetState)['features/app'];
b = Boolean(app && app.props.welcomePageEnabled);
} else {
b = true;
}
return b;
}
/**
* Determines whether the {@code WelcomePage} is enabled by the user either
* herself or through her deployment config(uration). Not to be confused with
* {@link isWelcomePageAppEnabled}.
*
* @param {Object|Function} stateOrGetState - The redux state or
* {@link getState} function.
* @returns {boolean} If the {@code WelcomePage} is enabled by the user, then
* {@code true}; otherwise, {@code false}.
*/
export function isWelcomePageUserEnabled(stateOrGetState: Object | Function) {
return (
typeof APP === 'undefined'
? true
: toState(stateOrGetState)['features/base/config'].enableWelcomePage
&& APP.settings.isWelcomePageEnabled());
}