Bryan L

06/09/2021, 11:48 PM
Day 70, 71, 72
• Implement DataStore in Daily Doc/withRemoteDatabase branch • Work on fixing schema for room database for physical device
• Held off on daily updates as I've been focused on getting DataStore to work. Decided not to give up on it, although with the amount of time I took, I probably should have used SharedPref as an alternative. ◦ What a great feeling to have it finally implemented! I need to clean up the extra code now that it's complete (not encrypted yet) ◦ Went back and forth between trying to use Preferences DataStore & Proto DataStore. The main difference between the two is that Preferences isn't Type-Safe while Proto is (uses Protocol Buffers) ◦ I ended up moving my enum class to save in datastore instead of in the navigation file. I believe this stemmed more from the info being drawn from in DrawerState which had to have some extra calls as the state kept getting destroyed / overwritten ◦ Took about a week longer than I anticipated to implement, but it's been a learning experience nonetheless 😆Some screenshots of spaghetti code before cleanup in thread. Had to come up with a lot of it myself as the examples I came across were hardly relevant to what I was implementing • Cleaned up some code and decided to test the app on my physical device. Cleared cache/data, however there was an issue with the schema since the database changed (id from long to string, date from string to long). Not sure why it's occuring even after clearing all data from device. Attempting to implement automigration, although I don't believe this will solve the problem. Emulator ran fine, just issues with physical device
🔥 1
A small amount of the code.. Perhaps adding copies of the files would have been better here 🤷‍♂️
Issue with schema changed / version for Room Db. Emulator runs fine, Physical device crashes on start. I've tried reinstalling the app and clearing cache, but still having issues. I attempted to solve with AutoMigration, but did not work.. I may have implemented it incorrectly. Will try to solve tomorrow, although I think the root of the problem runs deeper than just changing versions as my device wouldn't know have to worry about comparing previous/new versions of the database