2023-04-13 15:49:51 +03:00
|
|
|
import { NavigationContainer, Theme } from '@react-navigation/native';
|
2022-07-07 18:05:58 +03:00
|
|
|
import { createStackNavigator } from '@react-navigation/stack';
|
2022-05-06 11:20:22 +02:00
|
|
|
import React, { useCallback } from 'react';
|
2022-11-11 16:15:54 +01:00
|
|
|
import { StatusBar } from 'react-native';
|
2023-03-21 09:47:52 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-11-11 16:32:56 +02:00
|
|
|
|
2023-05-22 09:54:11 +03:00
|
|
|
import { IReduxState, IStore } from '../../../app/types';
|
2023-02-14 11:50:46 +02:00
|
|
|
import DialInSummary from '../../../invite/components/dial-in-summary/native/DialInSummary';
|
2022-10-28 12:07:58 +02:00
|
|
|
import Prejoin from '../../../prejoin/components/native/Prejoin';
|
2023-05-09 21:04:58 +03:00
|
|
|
import UnsafeRoomWarning from '../../../prejoin/components/native/UnsafeRoomWarning';
|
2023-07-14 11:42:15 +03:00
|
|
|
import { isUnsafeRoomWarningEnabled } from '../../../prejoin/functions';
|
2024-06-28 15:29:41 +03:00
|
|
|
import VisitorsQueue from '../../../visitors/components/native/VisitorsQueue';
|
2023-05-09 21:04:58 +03:00
|
|
|
// eslint-disable-next-line
|
|
|
|
|
// @ts-ignore
|
2022-07-28 10:28:29 +03:00
|
|
|
import WelcomePage from '../../../welcome/components/WelcomePage';
|
2022-06-16 12:49:07 +03:00
|
|
|
import { isWelcomePageEnabled } from '../../../welcome/functions';
|
2022-05-06 11:20:22 +02:00
|
|
|
import { _ROOT_NAVIGATION_READY } from '../actionTypes';
|
2022-01-25 14:55:57 +02:00
|
|
|
import { rootNavigationRef } from '../rootNavigationContainerRef';
|
|
|
|
|
import { screen } from '../routes';
|
2021-11-11 16:32:56 +02:00
|
|
|
import {
|
2022-06-16 12:49:07 +03:00
|
|
|
conferenceNavigationContainerScreenOptions,
|
|
|
|
|
connectingScreenOptions,
|
2021-11-11 16:32:56 +02:00
|
|
|
dialInSummaryScreenOptions,
|
2022-06-16 12:49:07 +03:00
|
|
|
navigationContainerTheme,
|
2022-07-28 10:28:29 +03:00
|
|
|
preJoinScreenOptions,
|
2023-05-09 21:04:58 +03:00
|
|
|
unsafeMeetingScreenOptions,
|
2024-06-28 15:29:41 +03:00
|
|
|
visitorsScreenOptions,
|
2024-04-02 13:11:36 +03:00
|
|
|
welcomeScreenOptions
|
2022-01-25 14:55:57 +02:00
|
|
|
} from '../screenOptions';
|
2021-11-11 16:32:56 +02:00
|
|
|
|
2022-03-17 16:13:58 +02:00
|
|
|
import ConnectingPage from './ConnectingPage';
|
2022-01-25 14:55:57 +02:00
|
|
|
import ConferenceNavigationContainer
|
|
|
|
|
from './conference/components/ConferenceNavigationContainer';
|
2021-11-11 16:32:56 +02:00
|
|
|
|
2022-07-07 18:05:58 +03:00
|
|
|
const RootStack = createStackNavigator();
|
2021-11-11 16:32:56 +02:00
|
|
|
|
|
|
|
|
|
2023-04-03 11:09:50 +03:00
|
|
|
interface IProps {
|
2021-11-11 16:32:56 +02:00
|
|
|
|
2022-05-06 11:20:22 +02:00
|
|
|
/**
|
|
|
|
|
* Redux dispatch function.
|
|
|
|
|
*/
|
2023-05-22 09:54:11 +03:00
|
|
|
dispatch: IStore['dispatch'];
|
2022-05-06 11:20:22 +02:00
|
|
|
|
2023-07-14 11:42:15 +03:00
|
|
|
/**
|
|
|
|
|
* Is unsafe room warning available?
|
|
|
|
|
*/
|
|
|
|
|
isUnsafeRoomWarningAvailable: boolean;
|
|
|
|
|
|
2021-11-11 16:32:56 +02:00
|
|
|
/**
|
|
|
|
|
* Is welcome page available?
|
|
|
|
|
*/
|
2023-02-14 11:50:46 +02:00
|
|
|
isWelcomePageAvailable: boolean;
|
2023-04-03 11:09:50 +03:00
|
|
|
}
|
2021-11-11 16:32:56 +02:00
|
|
|
|
|
|
|
|
|
2023-07-14 11:42:15 +03:00
|
|
|
const RootNavigationContainer = ({ dispatch, isUnsafeRoomWarningAvailable, isWelcomePageAvailable }: IProps) => {
|
2022-03-21 18:23:57 +02:00
|
|
|
const initialRouteName = isWelcomePageAvailable
|
2022-07-28 10:28:29 +03:00
|
|
|
? screen.welcome.main : screen.connecting;
|
2022-05-06 11:20:22 +02:00
|
|
|
const onReady = useCallback(() => {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: _ROOT_NAVIGATION_READY,
|
|
|
|
|
ready: true
|
|
|
|
|
});
|
|
|
|
|
}, [ dispatch ]);
|
2022-03-21 18:23:57 +02:00
|
|
|
|
|
|
|
|
return (
|
2022-05-06 05:18:57 -05:00
|
|
|
<NavigationContainer
|
|
|
|
|
independent = { true }
|
2022-05-06 11:20:22 +02:00
|
|
|
onReady = { onReady }
|
2022-05-06 05:18:57 -05:00
|
|
|
ref = { rootNavigationRef }
|
2023-04-13 15:49:51 +03:00
|
|
|
theme = { navigationContainerTheme as Theme }>
|
2022-11-11 16:15:54 +01:00
|
|
|
<StatusBar
|
|
|
|
|
animated = { true }
|
|
|
|
|
backgroundColor = 'transparent'
|
|
|
|
|
barStyle = { 'light-content' }
|
|
|
|
|
translucent = { true } />
|
2022-05-06 05:18:57 -05:00
|
|
|
<RootStack.Navigator
|
|
|
|
|
initialRouteName = { initialRouteName }>
|
|
|
|
|
{
|
|
|
|
|
isWelcomePageAvailable
|
|
|
|
|
&& <>
|
2023-04-13 15:49:51 +03:00
|
|
|
<RootStack.Screen // @ts-ignore
|
2022-07-28 10:28:29 +03:00
|
|
|
component = { WelcomePage }
|
|
|
|
|
name = { screen.welcome.main }
|
|
|
|
|
options = { welcomeScreenOptions } />
|
2022-05-06 05:18:57 -05:00
|
|
|
<RootStack.Screen
|
2023-05-09 11:05:11 +03:00
|
|
|
|
2023-04-25 13:50:52 +03:00
|
|
|
// @ts-ignore
|
2022-05-06 05:18:57 -05:00
|
|
|
component = { DialInSummary }
|
|
|
|
|
name = { screen.dialInSummary }
|
|
|
|
|
options = { dialInSummaryScreenOptions } />
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
<RootStack.Screen
|
|
|
|
|
component = { ConnectingPage }
|
|
|
|
|
name = { screen.connecting }
|
2022-06-16 12:49:07 +03:00
|
|
|
options = { connectingScreenOptions } />
|
|
|
|
|
<RootStack.Screen
|
|
|
|
|
component = { Prejoin }
|
|
|
|
|
name = { screen.preJoin }
|
|
|
|
|
options = { preJoinScreenOptions } />
|
2023-07-14 11:42:15 +03:00
|
|
|
{
|
|
|
|
|
isUnsafeRoomWarningAvailable
|
|
|
|
|
&& <RootStack.Screen
|
|
|
|
|
component = { UnsafeRoomWarning }
|
|
|
|
|
name = { screen.unsafeRoomWarning }
|
|
|
|
|
options = { unsafeMeetingScreenOptions } />
|
|
|
|
|
}
|
2024-06-28 15:29:41 +03:00
|
|
|
<RootStack.Screen
|
|
|
|
|
component = { VisitorsQueue }
|
|
|
|
|
name = { screen.visitorsQueue }
|
|
|
|
|
options = { visitorsScreenOptions } />
|
2022-05-06 05:18:57 -05:00
|
|
|
<RootStack.Screen
|
|
|
|
|
component = { ConferenceNavigationContainer }
|
|
|
|
|
name = { screen.conference.root }
|
2022-06-16 12:49:07 +03:00
|
|
|
options = { conferenceNavigationContainerScreenOptions } />
|
2022-05-06 05:18:57 -05:00
|
|
|
</RootStack.Navigator>
|
|
|
|
|
</NavigationContainer>
|
2022-03-21 18:23:57 +02:00
|
|
|
);
|
|
|
|
|
};
|
2021-11-11 16:32:56 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maps part of the Redux store to the props of this component.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} state - The Redux state.
|
2023-04-03 11:09:50 +03:00
|
|
|
* @returns {IProps}
|
2021-11-11 16:32:56 +02:00
|
|
|
*/
|
2023-02-14 11:50:46 +02:00
|
|
|
function mapStateToProps(state: IReduxState) {
|
2021-11-11 16:32:56 +02:00
|
|
|
return {
|
2023-07-14 11:42:15 +03:00
|
|
|
isUnsafeRoomWarningAvailable: isUnsafeRoomWarningEnabled(state),
|
2022-06-16 12:49:07 +03:00
|
|
|
isWelcomePageAvailable: isWelcomePageEnabled(state)
|
2021-11-11 16:32:56 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(RootNavigationContainer);
|