davidsansome / tsurukame

Tsurukame is an unofficial WaniKani app for iOS. It helps you learn Japanese Kanji.
https://tsurukame.app
Apache License 2.0
252 stars 58 forks source link

Fixes recent mistakes not sticking around after sync, cached #'s not being invalidated after logout/login #677

Closed Deadpikle closed 6 months ago

Deadpikle commented 6 months ago

My last PR, #674, had a small issue where recent mistakes were not sticking around in the database after an online assignment fetch due to subject_progress being wiped via a REPLACE INTO statement in LocalCachingClient.fetchAssignments. Instead of using REPLACE INTO, performs an UPDATE followed by an INSERT if the UPDATE did nothing.

Also fixes an issue I found where logging out of one account into another account without restarting the app didn't clear cached numbers in LocalCachingClient. Fixes this by invalidating items in LocalCachingClient.clearAllData. Also noticed that a force refresh would not clear the recent lesson count cached number from the web, so I also invalidated that on sync.

Closes #676

Deadpikle commented 6 months ago

Done and tested on iOS 17. That should work nicely.

Note for the future if it ever comes up: SQLite allows for this functionality as of version 3.24.0. iOS changes SQLite versions over time, but iOS 12 has version 3.24.0. Fortunately, Tsurukame also has a minimum version of iOS 12, so it should be fine to implement it this way. 👍

(P.S. Happy almost New Year!)

davidsansome commented 6 months ago

Done and tested on iOS 17. That should work nicely.

Note for the future if it ever comes up: SQLite allows for this functionality as of version 3.24.0. iOS changes SQLite versions over time, but iOS 12 has version 3.24.0. Fortunately, Tsurukame also has a minimum version of iOS 12, so it should be fine to implement it this way. 👍

(P.S. Happy almost New Year!)

Sweet, thanks for checking! Happy new year to you too!