What’s the recommend practice loading user-data du...
# compose-android
j
What’s the recommend practice loading user-data during app startup and routing to the appropriate navigation route using Jetpack Compose and the Splash Screen API. The easiest solution would be to have a separate “splash” activity, that checks if the user is logged in and routes to the “Main” activity, otherwise routes to a “Login” activity. To me, it seems odd/wrong to have multiple activities when all UIs are fully built in Compose and the activities only exist so that I can perform loading/routing during startup.
c
Generally you do this all in one Activity, separate nav destinations for Login and Main. Are you working on an existing app that has multiple activities?
j
It would be a completely new app.
c
Then you only need one Activity. If a user is able to use your app in some capacity without logging in, then that screen / destination will be your root destination. On that screen presumably there’s a way for them to reach the login destination if they want to. If a user must log in to make any use of your app, you can take the approach of having a splash/loading destination, which just shows a loading spinner for example, while your app checks if the user is logged in or not. If they’re logged in, go to your Main destination. Otherwise go to Login destination
c
Ian lake has stated a bunch of times that navigation component's rec on how to do this isn't specific to navigation-compose. so you can use his video from a few years ago here with a case study on login

https://youtu.be/09qjn706ITA?si=knAg-7X4R4wUM_EV&t=288

🙌 1
☝️ 1
if you use the plain url

https://youtu.be/09qjn706ITA

and search that in this channel then you'll also find a bunch of related discussions that have occured regarindg it
j
@Colton Idle Searching “

https://youtu.be/09qjn706ITA

” in this channel isn’t returning any result besides this your post yesterday.
c
Try #compose
This channel #compose-android is relatively new
All the Android stuff used to be in #compose
👍🏿 1
👍 1