2023-07-03 16:18:39 +08:00
|
|
|
import "react-native-gesture-handler";
|
2023-08-14 21:57:52 +08:00
|
|
|
import styles from "./src/styles";
|
2023-07-03 16:18:39 +08:00
|
|
|
import { NavigationContainer } from "@react-navigation/native";
|
|
|
|
import { createDrawerNavigator } from "@react-navigation/drawer";
|
2023-07-03 21:22:31 +08:00
|
|
|
import { Provider } from "react-redux";
|
|
|
|
import store from "./src/features/redux/Store/Store";
|
2023-07-04 14:18:48 +08:00
|
|
|
import "react-native-reanimated";
|
|
|
|
import "react-native-gesture-handler";
|
2023-07-04 16:08:24 +08:00
|
|
|
import * as Linking from "expo-linking";
|
2023-07-03 16:18:39 +08:00
|
|
|
|
|
|
|
import CustomDrawerContent from "./src/components/DrawerSettings/CustomDrawerContent";
|
|
|
|
import DrawerScreenSettings from "./src/components/DrawerSettings/DrawerScreenSettings";
|
|
|
|
|
|
|
|
import Home from "./src/routes/Home/Home";
|
|
|
|
import Login from "./src/routes/Login/Login";
|
|
|
|
import Register from "./src/routes/Register/Register";
|
2023-07-03 23:19:36 +08:00
|
|
|
import Onboarding from "./src/routes/Onboarding/Onboarding";
|
2023-07-04 14:18:48 +08:00
|
|
|
import Revalidation from "./src/routes/Revalidation/Revalidation";
|
2023-07-04 16:08:24 +08:00
|
|
|
import Activation from "./src/routes/Activation/Activation";
|
|
|
|
import { useState, useEffect } from "react";
|
2023-07-17 22:44:50 +08:00
|
|
|
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
2023-07-17 17:52:41 +08:00
|
|
|
import { StatusBar } from "expo-status-bar";
|
2023-07-17 22:44:50 +08:00
|
|
|
import UserInfoPage from "./src/routes/UserInfoPage/UserInfoPage";
|
2023-07-18 21:38:49 +08:00
|
|
|
import SubjectsPage from "./src/routes/SubjectsPage/SubjectsPage";
|
2023-08-06 14:25:09 +08:00
|
|
|
import Loading from "./src/routes/Loading/Loading";
|
2023-08-07 14:55:44 +08:00
|
|
|
import StartStudying from "./src/routes/StartStudying/StartStudying";
|
2023-08-14 21:13:46 +08:00
|
|
|
import { ToastProvider } from "react-native-toast-notifications";
|
2023-08-15 00:41:42 +08:00
|
|
|
import InfoIcon from "./src/icons/InfoIcon/InfoIcon";
|
2023-09-28 21:03:04 +08:00
|
|
|
import CreateGroup from "./src/routes/CreateGroup/CreateGroup";
|
2023-07-03 16:18:39 +08:00
|
|
|
|
|
|
|
const Drawer = createDrawerNavigator();
|
2023-07-03 16:18:27 +08:00
|
|
|
|
2023-07-04 16:08:24 +08:00
|
|
|
const linking = {
|
|
|
|
prefixes: [Linking.makeUrl("/")],
|
|
|
|
config: {
|
|
|
|
screens: {
|
2023-08-06 14:25:09 +08:00
|
|
|
Home: "",
|
2023-07-04 16:08:24 +08:00
|
|
|
Login: "login",
|
|
|
|
Register: "register",
|
|
|
|
Onboarding: "onboarding",
|
|
|
|
Revalidation: "revalidation",
|
|
|
|
Activation: "activation/:uid?/:token?",
|
|
|
|
NotFound: "*",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-07-06 17:19:19 +08:00
|
|
|
const queryClient = new QueryClient();
|
|
|
|
|
2023-07-03 16:18:27 +08:00
|
|
|
export default function App() {
|
2023-07-04 16:08:24 +08:00
|
|
|
const [initialRoute, setInitialRoute] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
|
|
async function getInitialURL() {
|
|
|
|
const url = await Linking.getInitialURL();
|
|
|
|
if (url) {
|
|
|
|
setInitialRoute(url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!initialRoute) {
|
|
|
|
getInitialURL();
|
|
|
|
}
|
|
|
|
}, [initialRoute]);
|
2023-07-03 16:18:27 +08:00
|
|
|
return (
|
2023-08-14 21:57:52 +08:00
|
|
|
<ToastProvider
|
2023-08-15 00:41:42 +08:00
|
|
|
icon={<InfoIcon size={32} />}
|
2023-08-14 21:57:52 +08:00
|
|
|
textStyle={{ ...styles.text_white_tiny_bold }}
|
|
|
|
>
|
2023-08-14 21:13:46 +08:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<Provider store={store}>
|
|
|
|
<StatusBar style="light" />
|
2023-07-17 22:44:50 +08:00
|
|
|
|
2023-08-14 21:13:46 +08:00
|
|
|
<NavigationContainer linking={linking} fallback={<Loading />}>
|
|
|
|
<Drawer.Navigator
|
|
|
|
initialRouteName="Revalidation"
|
|
|
|
drawerContent={CustomDrawerContent}
|
|
|
|
screenOptions={DrawerScreenSettings}
|
|
|
|
>
|
|
|
|
<Drawer.Screen name="Home" component={Home} />
|
|
|
|
<Drawer.Screen name="Login" component={Login} />
|
|
|
|
<Drawer.Screen name="Register" component={Register} />
|
|
|
|
<Drawer.Screen name="Onboarding" component={Onboarding} />
|
|
|
|
<Drawer.Screen name="Revalidation" component={Revalidation} />
|
|
|
|
<Drawer.Screen name="Activation" component={Activation} />
|
|
|
|
<Drawer.Screen name="User Info" component={UserInfoPage} />
|
|
|
|
<Drawer.Screen name="Subjects" component={SubjectsPage} />
|
|
|
|
<Drawer.Screen name="Start Studying" component={StartStudying} />
|
2023-09-28 21:03:04 +08:00
|
|
|
<Drawer.Screen name="Create Group" component={CreateGroup} />
|
2023-08-14 21:13:46 +08:00
|
|
|
</Drawer.Navigator>
|
|
|
|
</NavigationContainer>
|
|
|
|
</Provider>
|
|
|
|
</QueryClientProvider>
|
|
|
|
</ToastProvider>
|
2023-07-03 16:18:27 +08:00
|
|
|
);
|
|
|
|
}
|