You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* @flow */
  2. import { toState } from '../base/redux';
  3. declare var APP: Object;
  4. declare var config: Object;
  5. export * from './roomnameGenerator';
  6. /**
  7. * Determines whether the {@code WelcomePage} is enabled by the app itself
  8. * (e.g. programmatically via the Jitsi Meet SDK for Android and iOS). Not to be
  9. * confused with {@link isWelcomePageUserEnabled}.
  10. *
  11. * @param {Object|Function} stateOrGetState - The redux state or
  12. * {@link getState} function.
  13. * @returns {boolean} If the {@code WelcomePage} is enabled by the app, then
  14. * {@code true}; otherwise, {@code false}.
  15. */
  16. export function isWelcomePageAppEnabled(stateOrGetState: Object | Function) {
  17. let b;
  18. if (navigator.product === 'ReactNative') {
  19. // We introduced the welcomePageEnabled prop on App in Jitsi Meet SDK
  20. // for Android and iOS. There isn't a strong reason not to introduce it
  21. // on Web but there're a few considerations to be taken before I go
  22. // there among which:
  23. // - Enabling/disabling the Welcome page on Web historically
  24. // automatically redirects to a random room and that does not make sense
  25. // on mobile (right now).
  26. const { app } = toState(stateOrGetState)['features/app'];
  27. b = Boolean(app && app.props.welcomePageEnabled);
  28. } else {
  29. b = true;
  30. }
  31. return b;
  32. }
  33. /**
  34. * Determines whether the {@code WelcomePage} is enabled by the user either
  35. * herself or through her deployment config(uration). Not to be confused with
  36. * {@link isWelcomePageAppEnabled}.
  37. *
  38. * @param {Object|Function} stateOrGetState - The redux state or
  39. * {@link getState} function.
  40. * @returns {boolean} If the {@code WelcomePage} is enabled by the user, then
  41. * {@code true}; otherwise, {@code false}.
  42. */
  43. export function isWelcomePageUserEnabled(stateOrGetState: Object | Function) {
  44. return (
  45. typeof APP === 'undefined'
  46. ? true
  47. : toState(stateOrGetState)['features/base/config'].enableWelcomePage
  48. && APP.settings.isWelcomePageEnabled());
  49. }