Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

functions.ts 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. import { IStateful } from '../base/app/types';
  2. import { WELCOME_PAGE_ENABLED } from '../base/flags/constants';
  3. import { getFeatureFlag } from '../base/flags/functions';
  4. import { toState } from '../base/redux/functions';
  5. /**
  6. * Determines whether the {@code WelcomePage} is enabled.
  7. *
  8. * @param {IStateful} stateful - The redux state or {@link getState}
  9. * function.
  10. * @returns {boolean} If the {@code WelcomePage} is enabled by the app, then
  11. * {@code true}; otherwise, {@code false}.
  12. */
  13. export function isWelcomePageEnabled(stateful: IStateful) {
  14. if (navigator.product === 'ReactNative') {
  15. return getFeatureFlag(stateful, WELCOME_PAGE_ENABLED, false);
  16. }
  17. const config = toState(stateful)['features/base/config'];
  18. return !config.welcomePage?.disabled;
  19. }
  20. /**
  21. * Returns the configured custom URL (if any) to redirect to instead of the normal landing page.
  22. *
  23. * @param {IStateful} stateful - The redux state or {@link getState}.
  24. * @returns {string} - The custom URL.
  25. */
  26. export function getCustomLandingPageURL(stateful: IStateful) {
  27. return toState(stateful)['features/base/config'].welcomePage?.customUrl;
  28. }