Bryan L
06/04/2021, 1:26 AMDay 65
• Migrate current drawer screens into specific use screens
◦ LoginScreen, RegisterScreen, UserScreen, InfoScreen, LoadingScreen
• Researched DataStore & started Implementing it over SharedPreferences
◦ Started implementing DataStore to store information if user is logged in
Self-Comment
• Needed to make some room for login options (register / login) so I moved all the information into an InfoScreen. Did not create a way to navigate to it yet as it's irrelevant to handling user data.
◦ Decided to break down into more screens as I'll be using simple navigation utilizing when()
for now. Focusing on getting it working before I make adjustments!
• Spent a few hours learning about Datastore. I still struggle with trying to implement best practices instead of just coding it into the project and refactoring later. Will try to go ahead and implement features anyways and refactor later.
◦ Datastore seems to be saved differently than sharedPreferences. Most examples I've come across utilize datastore differently than what I have in mind. So having to use my own judgement!
◦ Datastore has recently been updated to beta version. Nearly every tutorial/sample I come across is deprecated or feels unreadable(used in complex ways making it difficult to learn from)
◦ Some Articles I found to be useful for my case:
▪︎ Prefer Storing Data with Jetpack DataStore Sep 2020
▪︎ Securing Android’s DataStore Apr 2021
• Working on understanding this, but it is inspired from EncryptedSharedPreferences which I used in the course.
• I'm still unsure if I want to remove FirebaseAuth for Google Sign in. I'm not sure if I will be able to save user information using my server or if it's intended to be utilized with Firebase storage only. I'll leave it for now and deal with it once user login works
• Didn't intend to spend the whole day trying to understand how to implement DataStore to fit my needs, but I decided that it's worth investing in since it's replacing SharedPreferences.
Glad to be back at this 8+ hours a day. After some trial and error I've come to the conclusion that I have to stay away from books / entertainment early in the morning/day otherwise I struggle with concentrating on my studies. I'll make sure to keep my early morning articles / content revolving around Kotlin / Jetpack libraries!
Day 66
• Create Login / Register User for DD
◦ Implement user fields in ViewModel
◦ Create Composable functions in appropriate Screen Composables
• Changed parameters of Note(dateCreated: String, id: Long) to Note(date: Long, noteId: String)
◦ Handled errors stemming from this
◦ Added TypeConverters to/from list to hold multiple users in a note
Self-Comment
• Been awhile since I've actually created Composables! Felt like I had to relearn a few things albeit they came easier this time around. Took longer than expected to create the composables along with editing state through the UserViewModel.
◦ UserViewModel is becoming quite large. I'll keep with it, but I wonder if I should be breaking it up into separate VMs..
• Had an issue with TypeConverters and tried debugging for some time. Forgot to add @TypeConverters(Converters::class)
to Database.. Simple mistake I somehow overlooked.. 🤦♂️
• Was finally able to get DD to run on the emulator after fixing a bunch of bugs. Feels wonderful to see it running after so long 😆🎉
Goals Tomorrow
• Continue with DD changes
◦ Implement basic login method
◦ Store basic login information in datastore until logged out
◦ Change how notes are saved / updated / fetched (get from server if internet connection)