feat: prefered language
This commit is contained in:
@@ -87,9 +87,7 @@ export default function LandingPage() {
|
|||||||
|
|
||||||
continuationHandledRef.current = true
|
continuationHandledRef.current = true
|
||||||
const nextVideoUrl =
|
const nextVideoUrl =
|
||||||
Platform.OS === 'web'
|
Platform.OS === 'web' ? welcomeVideo?.registrationIntroWeb : welcomeVideo?.registrationIntro
|
||||||
? welcomeVideo?.registrationIntroWeb
|
|
||||||
: welcomeVideo?.registrationIntro
|
|
||||||
|
|
||||||
if (typeof nextVideoUrl === 'string' && nextVideoUrl.trim().length > 0) {
|
if (typeof nextVideoUrl === 'string' && nextVideoUrl.trim().length > 0) {
|
||||||
setVideoUrl(nextVideoUrl)
|
setVideoUrl(nextVideoUrl)
|
||||||
@@ -102,10 +100,7 @@ export default function LandingPage() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EntryJingle active={!isAuthenticated && !selectedLanguage} />
|
<EntryJingle active={!isAuthenticated && !selectedLanguage} />
|
||||||
<Page
|
<Page title="Landing Page" backgroundImg={background.homeBGWeb}>
|
||||||
title="Landing Page"
|
|
||||||
backgroundImg={background.homeBGWeb}
|
|
||||||
>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
+13
-14
@@ -16,14 +16,24 @@ export default ({ navigation }) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const userRouting = async () => {
|
const userRouting = async () => {
|
||||||
try {
|
|
||||||
const uid = firebase.auth().currentUser?.uid
|
const uid = firebase.auth().currentUser?.uid
|
||||||
if (!uid) throw new Error('No user')
|
|
||||||
|
|
||||||
|
if (!uid) {
|
||||||
|
navigation.reset({
|
||||||
|
index: 0,
|
||||||
|
routes: [{ name: Routes.LandingPage }],
|
||||||
|
})
|
||||||
|
setIsFullyLoaded(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const userSnap = await usersRef.doc(uid).get()
|
const userSnap = await usersRef.doc(uid).get()
|
||||||
const user = userSnap?.data() || {}
|
const user = userSnap?.data() || {}
|
||||||
if (userSnap.exists) setCurrentUserData(user)
|
if (userSnap.exists) setCurrentUserData(user)
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Splash: unable to load user profile', error)
|
||||||
|
} finally {
|
||||||
navigation.reset({
|
navigation.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
routes: [
|
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)
|
setIsFullyLoaded(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user