thunderbiscuit / padawan-wallet

The bitcoin wallet trainer on Android.
https://padawanwallet.com/
Apache License 2.0
113 stars 50 forks source link

Pre-populate database with chapters' information #230

Closed thunderbiscuit closed 1 year ago

Prakhar-Agarwal-byte commented 1 year ago

@thunderbiscuit Do we need to pre-populate the chapters information from tutorial_db.db? If yes, then we can do it with .createFromAsset("databases/tutorial_db.db"). I didn't fully understand this comment. Could you please clarify it more? https://github.com/thunderbiscuit/padawan-wallet/blob/3dd73cbcce83cc3a67830d3bfc1612c52d330597/app/src/main/java/com/goldenraven/padawanwallet/data/chapters/ChaptersDatabase.kt#L28-L32

thunderbiscuit commented 1 year ago

Oh sorry I totally forgot to respond to this!

Yeah this was a little while ago and I don't remember why my idea of createFromAsset didn't work. I think it was that every time you started the app it would call this createFromAsset() method, when really we only need it to be called once, the first time a user opens the app. The problem with calling it every time is that it contains the "completed" variable, so if you load from the db file every time you reset all completed tutorials to 0, which is not what I want.

Instead at the moment the tutorials are hard-coded into strings and loaded into the db at every boot of the app (I think? can't remember for sure) and that feels like a waste.

Prakhar-Agarwal-byte commented 1 year ago

Got it! I will ensure that createFromAsset() gets called only the first time the user opens the app.