https://kotlinlang.org logo
Title
b

Bryan L

06/10/2021, 6:02 PM
Day 73
• Continued improving Login features in Daily Doc/withRemoteDatabase ◦ Circular Progress bar added ◦ Snackbar bug fixed ▪︎ coroutineScope moved inside of
when
block ▪︎ coroutine now only runs once and does not chain from multiple clicks causing a delay. Fixed by cancelling & launching anew ◦ Worked on login bug • Listened to podcast episode: Datastories by Android Developers Backstage
Self-Comment
• Today has been a bug fixing day, tomorrow will be as well. ◦ There seems to be an issue with the result being saved and not refreshed after the initial logout. Attempted to fix, but it could be a coroutine issue or how DataStore is being built. ▪︎ snackbar reads the login result correctly (incorrect credentials), but it still navigates to loginscreen with the incorrect credentials. (repeated in thread) ◦ Once I get the login bug fixed, I will clean up my code. • Added a simple circular progress bar to indicate loading, I still have the loadingScreen setup.. However, I may remove this screen all together as it's unnecessary (I'll just call the UserData Datastore onCreate) then call either LaunchedEffect or DisposableEffect to check authentication that will revert back to the LoginScreen or the UserScreen. ◦ After reading the docs on DisposableEffect/LaunchedEffect I've gained a better understanding of how it works. Looking forward to applying it tomorrow! • Podcast episode was enlightening. Has given me incentive to separate current DataStore into two DataStores. Although, it was mentioned that how I save my UiDrawerState might be better saved elsewhere such as Room. (ignoring this for now) 🤔
Goals Tomorrow
• Separate UserData and UiDrawerState into separate DataStores ◦ Call & Authorize UserData if logged in within Activity's onCreate() • Apply DisposableEffect (if doesn't work, apply LaunchedEffect) • Remove LoadingScreen • If Bug is fixed, record demo of login to share
:android-eyes: 1
👀 1
Discovered Bug. 1. Signing in on LoginScreen 2. Logging out navigates to correctly 3. Logging in with incorrect credentials works 🤔 a. Data isn't being updated immediately, if I log out of the user with incorrect credentials and try again, it results in an error(as it should)
I've been using
LaunchedEffect()
to help determine which screen to navigate to. (depending if user is logged in) While looking through the docs I discovered
DisposableEffect()
Has a relatable example as well, will be trying this! Docs Link