選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

route.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* @flow */
  2. import { RouteRegistry } from '../base/react';
  3. import { BlankWelcomePage, WelcomePage } from './components';
  4. import { generateRoomWithoutSeparator } from './roomnameGenerator';
  5. declare var APP: Object;
  6. declare var config: Object;
  7. /**
  8. * Register route for BlankWelcomePage.
  9. */
  10. RouteRegistry.register({
  11. component: BlankWelcomePage,
  12. undefined,
  13. path: '/#blank'
  14. });
  15. /**
  16. * Register route for WelcomePage.
  17. */
  18. RouteRegistry.register({
  19. component: WelcomePage,
  20. onEnter,
  21. path: '/'
  22. });
  23. /**
  24. * If the Welcome page/screen is disabled, generates a (random) room (name) so
  25. * that the Welcome page/screen is skipped and the Conference page/screen is
  26. * presented instead.
  27. *
  28. * @param {Object} nextState - The next Router state.
  29. * @param {Function} replace - The function to redirect to another path.
  30. * @returns {void}
  31. */
  32. function onEnter(nextState, replace) {
  33. // The disabling of the Welcome page by redirecting to a random room name is
  34. // a feature (1) we have on Web/React and (2) we do not want on mobile/React
  35. // Native (at the time of this writing).
  36. if (typeof APP === 'object'
  37. // TODO Technically, there is features/base/config now so it is
  38. // preferable to read config(uration) values from there and not rely
  39. // on a global variable. However, the redux store is not available
  40. // here at the time of this writing. Given the current (1) Web
  41. // exclusivity of the feature and (2) the reliance on other global
  42. // variables (e.g. APP), go with the global variable for now in
  43. // order to minimize the effort involved.
  44. && !(config.enableWelcomePage
  45. && APP.settings.isWelcomePageEnabled())) {
  46. const room = generateRoomWithoutSeparator();
  47. replace(`/${room}`);
  48. }
  49. }