2021-10-20 19:29:21 +00:00
|
|
|
|
|
|
|
import { isRoomValid } from '../base/conference';
|
|
|
|
import { toState } from '../base/redux';
|
|
|
|
import { ConferenceNavigationContainer } from '../conference';
|
2021-11-11 14:32:56 +00:00
|
|
|
import RootNavigationContainer from '../welcome/components/RootNavigationContainer';
|
2021-10-20 19:29:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines which route is to be rendered in order to depict a specific Redux
|
|
|
|
* store.
|
|
|
|
*
|
|
|
|
* @param {(Function|Object)} stateful - THe redux store, state, or
|
|
|
|
* {@code getState} function.
|
|
|
|
* @returns {Promise<Object>}
|
|
|
|
*/
|
|
|
|
export function _getRouteToRender(stateful) {
|
|
|
|
const state = toState(stateful);
|
|
|
|
|
|
|
|
return _getMobileRoute(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the {@code Route} to display on the React Native app.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
function _getMobileRoute(state) {
|
2021-11-11 14:32:56 +00:00
|
|
|
const route = {
|
|
|
|
component: null,
|
|
|
|
href: undefined
|
|
|
|
};
|
2021-10-20 19:29:21 +00:00
|
|
|
|
|
|
|
if (isRoomValid(state['features/base/conference'].room)) {
|
|
|
|
route.component = ConferenceNavigationContainer;
|
|
|
|
} else {
|
2021-11-11 14:32:56 +00:00
|
|
|
route.component = RootNavigationContainer;
|
2021-10-20 19:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.resolve(route);
|
|
|
|
}
|
|
|
|
|