diff --git a/src/screens/LandingPage.js b/src/screens/LandingPage.js index 35d1491..a772945 100644 --- a/src/screens/LandingPage.js +++ b/src/screens/LandingPage.js @@ -87,9 +87,7 @@ export default function LandingPage() { continuationHandledRef.current = true const nextVideoUrl = - Platform.OS === 'web' - ? welcomeVideo?.registrationIntroWeb - : welcomeVideo?.registrationIntro + Platform.OS === 'web' ? welcomeVideo?.registrationIntroWeb : welcomeVideo?.registrationIntro if (typeof nextVideoUrl === 'string' && nextVideoUrl.trim().length > 0) { setVideoUrl(nextVideoUrl) @@ -102,10 +100,7 @@ export default function LandingPage() { return ( <> - + { }, []) const userRouting = async () => { - try { - const uid = firebase.auth().currentUser?.uid - if (!uid) throw new Error('No user') + const uid = firebase.auth().currentUser?.uid + if (!uid) { + navigation.reset({ + index: 0, + routes: [{ name: Routes.LandingPage }], + }) + setIsFullyLoaded(true) + return + } + + try { const userSnap = await usersRef.doc(uid).get() const user = userSnap?.data() || {} if (userSnap.exists) setCurrentUserData(user) - + } catch (error) { + console.warn('Splash: unable to load user profile', error) + } finally { navigation.reset({ index: 0, routes: [ @@ -36,17 +46,6 @@ export default ({ navigation }) => { }, ], }) - } catch (error) { - // Pas d'utilisateur connecté => accueil avec tab bar - navigation.reset({ - index: 0, - routes: [ - { - name: Routes.BottomTab, - }, - ], - }) - } finally { setIsFullyLoaded(true) } }