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 1.8KB

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