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.

getRouteToRender.native.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { isRoomValid } from '../base/conference';
  2. import { toState } from '../base/redux';
  3. import { ConferenceNavigationContainer } from '../conference';
  4. import { isWelcomePageAppEnabled } from '../welcome';
  5. import { BlankPage, WelcomePage } from '../welcome/components';
  6. /**
  7. * Determines which route is to be rendered in order to depict a specific Redux
  8. * store.
  9. *
  10. * @param {(Function|Object)} stateful - THe redux store, state, or
  11. * {@code getState} function.
  12. * @returns {Promise<Object>}
  13. */
  14. export function _getRouteToRender(stateful) {
  15. const state = toState(stateful);
  16. return _getMobileRoute(state);
  17. }
  18. /**
  19. * Returns the {@code Route} to display on the React Native app.
  20. *
  21. * @param {Object} state - The redux state.
  22. * @returns {Promise}
  23. */
  24. function _getMobileRoute(state) {
  25. const route = _getEmptyRoute();
  26. if (isRoomValid(state['features/base/conference'].room)) {
  27. route.component = ConferenceNavigationContainer;
  28. } else if (isWelcomePageAppEnabled(state)) {
  29. route.component = WelcomePage;
  30. } else {
  31. route.component = BlankPage;
  32. }
  33. return Promise.resolve(route);
  34. }
  35. /**
  36. * Returns the default {@code Route}.
  37. *
  38. * @returns {Object}
  39. */
  40. function _getEmptyRoute() {
  41. return {
  42. component: BlankPage,
  43. href: undefined
  44. };
  45. }