diff --git a/.gitignore b/.gitignore index 4ac34445..38ca8150 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,9 @@ eas.json credentials.json credentials/ + +# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb +# The following patterns were generated by expo-cli + +expo-env.d.ts +# @end expo-cli \ No newline at end of file diff --git a/app.config.json b/app.config.json index f300569a..e1c8be5b 100644 --- a/app.config.json +++ b/app.config.json @@ -39,7 +39,8 @@ }, "sdkVersion": "52.0.0", "experiments": { - "tsconfigPaths": true + "tsconfigPaths": true, + "typedRoutes": true }, "plugins": [ ["react-native-edge-to-edge"], diff --git a/src/app/(flow)/onboarding.tsx b/src/app/(flow)/onboarding.tsx index 6e9d5670..c0eeb90f 100644 --- a/src/app/(flow)/onboarding.tsx +++ b/src/app/(flow)/onboarding.tsx @@ -79,7 +79,7 @@ export default function OnboardingScreen(): JSX.Element { flow.setUpdated(true) flow.setAnalyticsAllowed(true) router.navigate({ - pathname: '(screens)/login', + pathname: '/login', params: { fromOnboarding: 'true' }, }) }} diff --git a/src/app/(flow)/whatsnew.tsx b/src/app/(flow)/whatsnew.tsx index dd0a773f..e700ec58 100644 --- a/src/app/(flow)/whatsnew.tsx +++ b/src/app/(flow)/whatsnew.tsx @@ -31,7 +31,7 @@ export default function WhatsNewScreen(): JSX.Element { Application.nativeApplicationVersion ?? '0.0.0' ) if (changelog.version[version] === undefined) { - router.navigate('(tabs)/(index)') + router.navigate('/(tabs)/(index)') } const totalItems = Object.keys(changelog.version[version] ?? []).flatMap( (key) => changelog.version[key] @@ -173,7 +173,7 @@ export default function WhatsNewScreen(): JSX.Element { style={styles.button} onPress={() => { flow.setUpdated(true) - router.navigate('(tabs)/(index)') + router.navigate('/(tabs)/(index)') }} > diff --git a/src/app/(screens)/about.tsx b/src/app/(screens)/about.tsx index a31a38be..fbb7fd34 100644 --- a/src/app/(screens)/about.tsx +++ b/src/app/(screens)/about.tsx @@ -56,7 +56,7 @@ export default function About(): JSX.Element { title: 'Changelog', icon: chevronIcon, onPress: () => { - router.navigate('changelog') + router.navigate('/changelog') }, }, { @@ -124,7 +124,7 @@ export default function About(): JSX.Element { title: t('about.formlist.legal.button'), icon: chevronIcon, onPress: () => { - router.navigate('legal') + router.navigate('/legal') }, }, ], diff --git a/src/app/(screens)/calendar.tsx b/src/app/(screens)/calendar.tsx index dbc73e39..86bc1e4e 100644 --- a/src/app/(screens)/calendar.tsx +++ b/src/app/(screens)/calendar.tsx @@ -57,7 +57,7 @@ export default function CalendarPage(): JSX.Element { gcTime: 1000 * 60 * 60 * 24, // 24 hours retry(failureCount, error) { if (error instanceof NoSessionError) { - router.push(' login') + router.push('/login') return false } return failureCount < 2 diff --git a/src/app/(screens)/dashboard.tsx b/src/app/(screens)/dashboard.tsx index a4712126..4421f302 100644 --- a/src/app/(screens)/dashboard.tsx +++ b/src/app/(screens)/dashboard.tsx @@ -174,7 +174,7 @@ export default function DashboardEdit(): JSX.Element { { - router.navigate('login') + router.navigate('/login') }} > diff --git a/src/app/(screens)/foodPreferences.tsx b/src/app/(screens)/foodPreferences.tsx index f103eb24..9ebc4c72 100644 --- a/src/app/(screens)/foodPreferences.tsx +++ b/src/app/(screens)/foodPreferences.tsx @@ -63,14 +63,14 @@ export default function FoodPreferences(): JSX.Element { title: t('preferences.formlist.allergens'), icon: chevronIcon, onPress: () => { - router.push('foodAllergens') + router.push('/foodAllergens') }, }, { title: t('preferences.formlist.flags'), icon: chevronIcon, onPress: () => { - router.push('foodFlags') + router.push('/foodFlags') }, }, ], diff --git a/src/app/(screens)/grades.tsx b/src/app/(screens)/grades.tsx index 2122ea12..e5acea1c 100644 --- a/src/app/(screens)/grades.tsx +++ b/src/app/(screens)/grades.tsx @@ -84,7 +84,7 @@ export default function GradesSCreen(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 7, // 1 week retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') } return false }, diff --git a/src/app/(screens)/lecture.tsx b/src/app/(screens)/lecture.tsx index c8cb5703..cbf0d65f 100644 --- a/src/app/(screens)/lecture.tsx +++ b/src/app/(screens)/lecture.tsx @@ -95,7 +95,7 @@ export default function TimetableDetails(): JSX.Element { icon: chevronIcon, onPress: () => { router.push({ - pathname: 'webView', + pathname: '/webView', params: { title: t(titleKey), html, @@ -251,7 +251,7 @@ export default function TimetableDetails(): JSX.Element { onPress={() => { router.dismissTo({ pathname: - '(tabs)/map', + '/(tabs)/map', params: { room, }, diff --git a/src/app/(screens)/lecturer.tsx b/src/app/(screens)/lecturer.tsx index a859ee3a..070e52c5 100644 --- a/src/app/(screens)/lecturer.tsx +++ b/src/app/(screens)/lecturer.tsx @@ -69,7 +69,7 @@ export default function LecturerDetail(): JSX.Element { textColor: theme.colors.primary, onPress: () => { router.dismissTo({ - pathname: '(tabs)/map', + pathname: '/(tabs)/map', params: { room: lecturer?.room_short ?? '' }, }) }, diff --git a/src/app/(screens)/lecturers.tsx b/src/app/(screens)/lecturers.tsx index 3f0a597d..3b087914 100644 --- a/src/app/(screens)/lecturers.tsx +++ b/src/app/(screens)/lecturers.tsx @@ -89,7 +89,7 @@ export default function LecturersCard(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 7, // 7 days retry(failureCount: number, error: any) { if (error instanceof NoSessionError) { - router.push('login') + router.push('/login') return false } return failureCount < 2 @@ -107,7 +107,7 @@ export default function LecturersCard(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 7, // 7 days retry(failureCount: number, error: any) { if (error instanceof NoSessionError) { - router.navigate('login') + router.navigate('/login') return false } return failureCount < 2 diff --git a/src/app/(screens)/library.tsx b/src/app/(screens)/library.tsx index 73d8dd0c..007a920f 100644 --- a/src/app/(screens)/library.tsx +++ b/src/app/(screens)/library.tsx @@ -94,7 +94,7 @@ export default function LibrarySreen(): JSX.Element { gcTime: 1000 * 60 * 60 * 24, // 24 hours, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 @@ -116,7 +116,7 @@ export default function LibrarySreen(): JSX.Element { gcTime: 1000 * 60 * 60 * 24, // 24 hours, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 @@ -179,7 +179,7 @@ export default function LibrarySreen(): JSX.Element { }, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 1 diff --git a/src/app/(screens)/licenses.tsx b/src/app/(screens)/licenses.tsx index a48931d3..b9366ad6 100644 --- a/src/app/(screens)/licenses.tsx +++ b/src/app/(screens)/licenses.tsx @@ -71,7 +71,7 @@ export default function Licenses(): JSX.Element { icon: chevronIcon, onPress: () => { router.navigate({ - pathname: 'license', + pathname: '/license', params: { license: value.licenses, version: version != null ? version[0] : '', diff --git a/src/app/(screens)/login.tsx b/src/app/(screens)/login.tsx index d2da6a2d..532a7b20 100644 --- a/src/app/(screens)/login.tsx +++ b/src/app/(screens)/login.tsx @@ -96,7 +96,7 @@ export default function Login(): JSX.Element { const navigateHome = (): void => { if (fromOnboarding === 'true') { router.dismissAll() - router.replace('(tabs)/(index)') + router.replace('/(tabs)/(index)') return } router.dismissAll() diff --git a/src/app/(screens)/meal.tsx b/src/app/(screens)/meal.tsx index aafbcd23..703f15d4 100644 --- a/src/app/(screens)/meal.tsx +++ b/src/app/(screens)/meal.tsx @@ -302,7 +302,7 @@ export default function FoodDetail(): JSX.Element { if (restaurant != null && location !== undefined) { router.dismissTo({ - pathname: '(tabs)/map', + pathname: '/(tabs)/map', params: { room: location }, }) } diff --git a/src/app/(screens)/profile.tsx b/src/app/(screens)/profile.tsx index cc1eaba0..980a06b0 100644 --- a/src/app/(screens)/profile.tsx +++ b/src/app/(screens)/profile.tsx @@ -46,7 +46,7 @@ export default function Profile(): JSX.Element { enabled: userKind === USER_STUDENT, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 diff --git a/src/app/(screens)/roomSearch.ios.tsx b/src/app/(screens)/roomSearch.ios.tsx index be24bd3b..6f09a120 100644 --- a/src/app/(screens)/roomSearch.ios.tsx +++ b/src/app/(screens)/roomSearch.ios.tsx @@ -87,7 +87,7 @@ export default function AdvancedSearch(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 4, // 4 days retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 diff --git a/src/app/(screens)/roomSearch.tsx b/src/app/(screens)/roomSearch.tsx index 7133513d..af34fc22 100644 --- a/src/app/(screens)/roomSearch.tsx +++ b/src/app/(screens)/roomSearch.tsx @@ -68,7 +68,7 @@ export default function AdvancedSearch(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 4, // 4 days retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 diff --git a/src/app/(screens)/settings.tsx b/src/app/(screens)/settings.tsx index 861c8207..100ed6cb 100644 --- a/src/app/(screens)/settings.tsx +++ b/src/app/(screens)/settings.tsx @@ -177,7 +177,7 @@ export default function Settings(): JSX.Element { gcTime: 1000 * 60 * 60 * 24 * 60, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } else if (userKind !== 'student') { return false @@ -224,7 +224,7 @@ export default function Settings(): JSX.Element { }, onPress: () => { - router.navigate('dashboard') + router.navigate('/dashboard') }, }, { @@ -234,7 +234,7 @@ export default function Settings(): JSX.Element { ios: 'fork.knife', }, onPress: () => { - router.navigate('foodPreferences') + router.navigate('/foodPreferences') }, }, { @@ -268,7 +268,7 @@ export default function Settings(): JSX.Element { android: 'palette', }, onPress: () => { - router.navigate('accent') + router.navigate('/accent') }, }, { @@ -278,7 +278,7 @@ export default function Settings(): JSX.Element { android: 'routine', }, onPress: () => { - router.navigate('theme') + router.navigate('/theme') }, }, ...(Platform.OS === 'ios' && @@ -291,7 +291,7 @@ export default function Settings(): JSX.Element { android: '' as MaterialIcon, }, onPress: () => { - router.navigate('appIcon') + router.navigate('/appIcon') }, }, ] @@ -308,7 +308,7 @@ export default function Settings(): JSX.Element { android: 'chevron_right', }, onPress: () => { - router.navigate('about') + router.navigate('/about') }, }, @@ -382,9 +382,9 @@ export default function Settings(): JSX.Element { logoutAlert() } else { if (userKind === 'student') { - router.navigate('profile') + router.navigate('/profile') } else if (userKind === 'guest') { - router.navigate('login') + router.navigate('/login') } } }} diff --git a/src/app/(tabs)/(index)/index.tsx b/src/app/(tabs)/(index)/index.tsx index 32007db7..cf67c8cb 100644 --- a/src/app/(tabs)/(index)/index.tsx +++ b/src/app/(tabs)/(index)/index.tsx @@ -105,7 +105,7 @@ function HomeScreen(): JSX.Element { }} buttonText={t('dashboard.noShownButton', { ns: 'settings' })} onButtonPress={() => { - router.navigate('dashboard') + router.navigate('/dashboard') }} isCritical={false} /> diff --git a/src/app/(tabs)/_layout.tsx b/src/app/(tabs)/_layout.tsx index 2086fac8..4e574db0 100644 --- a/src/app/(tabs)/_layout.tsx +++ b/src/app/(tabs)/_layout.tsx @@ -11,7 +11,7 @@ import { USER_GUEST } from '@/data/constants' import { convertToMajorMinorPatch } from '@/utils/app-utils' import Aptabase from '@aptabase/react-native' import * as Application from 'expo-application' -import { Redirect, useRouter } from 'expo-router' +import { Redirect, type RelativePathString, useRouter } from 'expo-router' import React, { useContext, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { Platform } from 'react-native' @@ -101,7 +101,7 @@ export default function HomeLayout(): JSX.Element { ] function processShortcut(item: ShortcutItem): void { router.navigate({ - pathname: item.data.path as string, + pathname: item.data.path as RelativePathString, params: { fromAppShortcut: 'true' }, }) } @@ -144,7 +144,7 @@ export default function HomeLayout(): JSX.Element { }, [appIcon]) if (isOnboarded !== true) { - return + return } const version = Application.nativeApplicationVersion @@ -160,7 +160,7 @@ export default function HomeLayout(): JSX.Element { isChangelogAvailable && flow.isOnboarded === true ) { - return + return } return Platform.OS === 'android' ? : diff --git a/src/app/[...unmachted].tsx b/src/app/[...unmachted].tsx index b4d4fc1f..6489abe8 100644 --- a/src/app/[...unmachted].tsx +++ b/src/app/[...unmachted].tsx @@ -31,7 +31,7 @@ export default function Unmatched(): JSX.Element { if (router.canGoBack()) { router.back() } else { - router.replace('(tabs)/(index)') + router.replace('/(tabs)/(index)') } }} /> diff --git a/src/app/_layout.tsx b/src/app/_layout.tsx index 5b21c14d..76c9ba0f 100644 --- a/src/app/_layout.tsx +++ b/src/app/_layout.tsx @@ -359,7 +359,7 @@ function RootLayout(): JSX.Element { headerRight: () => ( { - router.push('(screens)/libraryCode') + router.push('/libraryCode') }} accessibilityLabel={t('button.libraryBarcode', { ns: 'accessibility', diff --git a/src/app/index.tsx b/src/app/index.tsx index 671aeca4..c0c9660f 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -25,7 +25,7 @@ export default function App(): JSX.Element { - + ) diff --git a/src/components/Cards/BaseCard.tsx b/src/components/Cards/BaseCard.tsx index 09f0e251..6c212963 100644 --- a/src/components/Cards/BaseCard.tsx +++ b/src/components/Cards/BaseCard.tsx @@ -1,7 +1,7 @@ // BaseCard Component to show the card on the dashboard to navigate to the corresponding page import { USER_GUEST } from '@/data/constants' import { type MaterialIcon } from '@/types/material-icons' -import { router } from 'expo-router' +import { type RelativePathString, router } from 'expo-router' import React, { useContext } from 'react' import { useTranslation } from 'react-i18next' import { Platform, Pressable, Text, View } from 'react-native' @@ -62,7 +62,8 @@ const BaseCard: React.FC = ({ { - onPressRoute != null && router.navigate(onPressRoute) + onPressRoute != null && + router.navigate(onPressRoute as RelativePathString) }} delayLongPress={300} onLongPress={() => {}} @@ -73,14 +74,15 @@ const BaseCard: React.FC = ({ actions={actions} onPress={(e) => { e.nativeEvent.name === t('contextMenu.settings') && - router.navigate('dashboard') + router.navigate('/dashboard') e.nativeEvent.name === t('contextMenu.hide') && hideDashboardEntry(title) e.nativeEvent.name === t('contextMenu.reset') && resetOrder(userKind ?? 'guest') }} onPreviewPress={() => { - onPressRoute != null && router.navigate(onPressRoute) + onPressRoute != null && + router.navigate(onPressRoute as RelativePathString) }} > diff --git a/src/components/Cards/CalendarCard.tsx b/src/components/Cards/CalendarCard.tsx index 3acd1a24..63b32c38 100644 --- a/src/components/Cards/CalendarCard.tsx +++ b/src/components/Cards/CalendarCard.tsx @@ -40,7 +40,7 @@ const CalendarCard = (): JSX.Element => { } catch (e) { if (e instanceof NoSessionError) { if (flow.isOnboarded === true) { - router.navigate('login') + router.navigate('/login') } } else if ((e as Error).message === 'Query not possible') { // ignore, leaving examList empty @@ -58,7 +58,7 @@ const CalendarCard = (): JSX.Element => { gcTime: 1000 * 60 * 60 * 24, // 24 hours retry(failureCount, error) { if (error instanceof NoSessionError) { - router.navigate('login') + router.navigate('/login') return false } return failureCount < 2 diff --git a/src/components/Cards/LibraryCard.tsx b/src/components/Cards/LibraryCard.tsx index 3edb4a2a..79a2ef4b 100644 --- a/src/components/Cards/LibraryCard.tsx +++ b/src/components/Cards/LibraryCard.tsx @@ -35,7 +35,7 @@ const LibraryCard = (): JSX.Element => { enabled: userKind !== USER_GUEST, retry(failureCount, error) { if (error instanceof NoSessionError) { - router.replace('login') + router.replace('/login') return false } return failureCount < 2 diff --git a/src/components/Dashboard/HeaderRight.tsx b/src/components/Dashboard/HeaderRight.tsx index ad2734da..7f4599bc 100644 --- a/src/components/Dashboard/HeaderRight.tsx +++ b/src/components/Dashboard/HeaderRight.tsx @@ -229,22 +229,22 @@ export const IndexHeaderRight = (): JSX.Element => { ]} onPress={(e) => { if (e.nativeEvent.name === t('navigation.profile')) { - router.push('profile') + router.push('/profile') } else if (e.nativeEvent.name === t('navigation.accent')) { - router.push('accent') + router.push('/accent') } else if (e.nativeEvent.name === t('navigation.about')) { - router.push('about') + router.push('/about') } else if (e.nativeEvent.name === 'Logout') { logoutAlert() } else if ( e.nativeEvent.name === t('menu.guest.title', { ns: 'settings' }) ) { - router.push('login') + router.push('/login') } }} onPreviewPress={() => { - router.navigate('settings') + router.navigate('/settings') }} > {children} @@ -255,7 +255,7 @@ export const IndexHeaderRight = (): JSX.Element => { return ( { - router.navigate('settings') + router.navigate('/settings') }} delayLongPress={300} onLongPress={() => {}} diff --git a/src/components/Error/ErrorView.tsx b/src/components/Error/ErrorView.tsx index 5bd7627d..a955c192 100644 --- a/src/components/Error/ErrorView.tsx +++ b/src/components/Error/ErrorView.tsx @@ -116,7 +116,7 @@ export default function ErrorView({ const buttonAction = (): void => { switch (title) { case guestError: - router.navigate('login') + router.navigate('/login') break default: if (onButtonPress != null) { @@ -130,7 +130,7 @@ export default function ErrorView({ if (title === guestError) { buttonProps = { onPress: () => { - router.navigate('login') + router.navigate('/login') }, text: t('error.guest.button'), } diff --git a/src/components/Food/AllergensBanner.tsx b/src/components/Food/AllergensBanner.tsx index 3f1bc605..c64ec8c1 100644 --- a/src/components/Food/AllergensBanner.tsx +++ b/src/components/Food/AllergensBanner.tsx @@ -50,7 +50,7 @@ export const AllergensBanner = ({ { - router.push('foodAllergens') + router.push('/foodAllergens') }} > diff --git a/src/components/Food/HeaderRight.tsx b/src/components/Food/HeaderRight.tsx index efcdbab0..eca97e92 100644 --- a/src/components/Food/HeaderRight.tsx +++ b/src/components/Food/HeaderRight.tsx @@ -12,7 +12,7 @@ export const FoodHeaderRight = (): JSX.Element => { return ( { - router.push('foodPreferences') + router.push('/foodPreferences') }} hitSlop={10} style={styles.headerButton} diff --git a/src/components/Food/MealEntry.tsx b/src/components/Food/MealEntry.tsx index 18fc8015..a8cc42cd 100644 --- a/src/components/Food/MealEntry.tsx +++ b/src/components/Food/MealEntry.tsx @@ -131,7 +131,7 @@ export const MealEntry = ({ JSON.stringify(meal) ).toString('base64') router.push({ - pathname: 'meal', + pathname: '/meal', params: { foodEntry: base64Event, }, @@ -155,7 +155,7 @@ export const MealEntry = ({ JSON.stringify(meal) ).toString('base64') router.push({ - pathname: 'meal', + pathname: '/meal', params: { foodEntry: base64Event, }, diff --git a/src/components/Map/AvailableRoomsSuggestions.tsx b/src/components/Map/AvailableRoomsSuggestions.tsx index 41ba112b..6ae8dff2 100644 --- a/src/components/Map/AvailableRoomsSuggestions.tsx +++ b/src/components/Map/AvailableRoomsSuggestions.tsx @@ -43,7 +43,7 @@ const AvailableRoomsSuggestions: React.FC = ({ {userKind !== USER_GUEST && ( { - router.navigate('roomSearch') + router.navigate('/roomSearch') }} hitSlop={{ top: 10, @@ -61,7 +61,7 @@ const AvailableRoomsSuggestions: React.FC = ({ { - router.navigate('login') + router.navigate('/login') }} disabled={userKind !== USER_GUEST} > diff --git a/src/components/Map/FreeRoomsList.tsx b/src/components/Map/FreeRoomsList.tsx index cb1830b9..caaea321 100644 --- a/src/components/Map/FreeRoomsList.tsx +++ b/src/components/Map/FreeRoomsList.tsx @@ -28,7 +28,7 @@ export const FreeRoomsList: React.FC = ({ rooms }) => { void InteractionManager.runAfterInteractions( () => { router.navigate({ - pathname: '(tabs)/map', + pathname: '/(tabs)/map', params: { room: room.room }, }) } diff --git a/src/components/Rows/CalendarRow.tsx b/src/components/Rows/CalendarRow.tsx index cf3312f9..6f7e0289 100644 --- a/src/components/Rows/CalendarRow.tsx +++ b/src/components/Rows/CalendarRow.tsx @@ -60,7 +60,7 @@ const ExamRow = ({ event }: { event: Exam }): JSX.Element => { const base64Event = Buffer.from(JSON.stringify(event)).toString('base64') const navigateToPage = (): void => { router.push({ - pathname: 'exam', + pathname: '/exam', params: { examEntry: base64Event }, }) } diff --git a/src/components/Rows/EventRow.tsx b/src/components/Rows/EventRow.tsx index 45a78116..f4c8bf20 100644 --- a/src/components/Rows/EventRow.tsx +++ b/src/components/Rows/EventRow.tsx @@ -27,7 +27,7 @@ const CLEventRow = ({ event }: { event: CLEvents }): JSX.Element => { 'base64' ) router.navigate({ - pathname: 'clEvent', + pathname: '/clEvent', params: { clEventEntry: base64Event }, }) } diff --git a/src/components/Rows/LecturerRow.tsx b/src/components/Rows/LecturerRow.tsx index d2e54799..3d74bdb2 100644 --- a/src/components/Rows/LecturerRow.tsx +++ b/src/components/Rows/LecturerRow.tsx @@ -13,14 +13,14 @@ const LecturerRow = ({ item }: { item: NormalizedLecturer }): JSX.Element => { const onPressRoom = (): void => { router.dismissTo({ - pathname: '(tabs)/map', + pathname: '/(tabs)/map', params: { room: item.room_short ?? '' }, }) } const onPressRow = (): void => { const base64Event = Buffer.from(JSON.stringify(item)).toString('base64') router.navigate({ - pathname: 'lecturer', + pathname: '/lecturer', params: { lecturerEntry: base64Event }, }) } diff --git a/src/components/Rows/SportsRow.tsx b/src/components/Rows/SportsRow.tsx index 0ace46d6..2a54514a 100644 --- a/src/components/Rows/SportsRow.tsx +++ b/src/components/Rows/SportsRow.tsx @@ -18,7 +18,7 @@ const SportsRow = ({ event }: { event: UniversitySports }): JSX.Element => { 'base64' ) router.navigate({ - pathname: 'sportsEvent', + pathname: '/sportsEvent', params: { sportsEventEntry: base64Event }, }) } diff --git a/src/components/Timetable/TimetableList.tsx b/src/components/Timetable/TimetableList.tsx index 21016504..691d1bdf 100644 --- a/src/components/Timetable/TimetableList.tsx +++ b/src/components/Timetable/TimetableList.tsx @@ -98,7 +98,7 @@ export default function TimetableList({ ) router.navigate({ - pathname: 'lecture', + pathname: '/lecture', params: { lecture: base64Event }, }) } @@ -183,7 +183,7 @@ export default function TimetableList({ const base64Event = Buffer.from(JSON.stringify(exam)).toString('base64') const navigateToPage = (): void => { router.push({ - pathname: 'exam', + pathname: '/exam', params: { examEntry: base64Event }, }) } diff --git a/src/components/Timetable/TimetableWeek.tsx b/src/components/Timetable/TimetableWeek.tsx index a461abe5..7487a2b2 100644 --- a/src/components/Timetable/TimetableWeek.tsx +++ b/src/components/Timetable/TimetableWeek.tsx @@ -345,14 +345,14 @@ export default function TimetableWeek({ if (entry.eventType === 'exam') { const navigateToPage = (): void => { router.navigate({ - pathname: 'exam', + pathname: '/exam', params: { examEntry: base64Event }, }) } navigateToPage() } else if (entry.eventType === 'lecture') { router.navigate({ - pathname: 'lecture', + pathname: '/lecture', params: { lecture: base64Event, }, diff --git a/src/utils/api-utils.ts b/src/utils/api-utils.ts index 7ae7d0f3..def37578 100644 --- a/src/utils/api-utils.ts +++ b/src/utils/api-utils.ts @@ -50,7 +50,7 @@ export const performLogout = async ( resetDashboard(USER_GUEST) await createGuestSession() queryClient.clear() - router.navigate('(tabs)/(index)') + router.navigate('/(tabs)/(index)') } catch (e) { console.debug(e) } diff --git a/src/utils/app-utils.ts b/src/utils/app-utils.ts index 03176e57..f7919e44 100644 --- a/src/utils/app-utils.ts +++ b/src/utils/app-utils.ts @@ -2,7 +2,7 @@ import { authenticateAsync, getEnrolledLevelAsync, } from 'expo-local-authentication' -import { router } from 'expo-router' +import { type RelativePathString, router } from 'expo-router' /** * Converts a version string in the format x.y.z to x.y. @@ -44,7 +44,7 @@ export const handleBiometricAuth = async (path: string): Promise => { const securityLevel = await getEnrolledLevelAsync() if (securityLevel === 0) { // no passcode or biometric auth set up - router.navigate(path) + router.navigate(path as RelativePathString) return } @@ -54,6 +54,6 @@ export const handleBiometricAuth = async (path: string): Promise => { }) if (biometricAuth.success) { - router.navigate(path) + router.navigate(path as RelativePathString) } } diff --git a/tsconfig.json b/tsconfig.json index 03cce3b5..2403eaa8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,5 +8,12 @@ }, "project": "./tsconfig.json", "strict": true - } + }, + "include": [ + "**/*.ts", + "**/*.tsx", + ".expo/types/**/*.ts", + "expo-env.d.ts", + "babel.config.js" + ] }