thunderbiscuit / padawan-wallet

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

Feature: Adding Indiv Tutorials #193

Closed fivetran-tangyetong closed 2 years ago

fivetran-tangyetong commented 2 years ago

Adding the individual tutorial content to the screens. I have hard-coded retrieving the content for each of the screens, since I'm not sure if theres a better, more scalable way to handle this.

The title and headers are centered, and the paragraphs are aligned left.

thunderbiscuit commented 2 years ago

Yeah this is awesome! Just having the content there is already a big win, plus the fact that it's all handled in one file is just so much better than my previous 8-file version.

A few ideas:

  1. Why don't we create an enum for the tutorials? I haven't thought through the exact way you'd have to make it work with the navigator which requires a string I think, but maybe something like:
    enum class Tutorial(val id: String) {
    T0("0")
    T1("1")
    // ...
    }

    This would enable the removal of the else clause at the end of the when statement.

thunderbiscuit commented 2 years ago

FYI the keyword I try to use for new features in the commit message is Feat. So far I haven't used formal tools to search the codebase or triage commits and whatnot, but if ever we do it will be helpful to have all the same tags spelled the same.

fivetran-tangyetong commented 2 years ago

Added the enum and relevant code, though I think I could use some feedback on the way I went about it.

thunderbiscuit commented 2 years ago

Ok so my initial idea wasn't so good because I had not internalized that you really only pass strings to the navigation in Compose (I initially pictured just passing the enum for tutorials, which would have been so much simpler).

Here is an idea: make the TutorialsScreen take the Tutorial enum, and reconstruct that enum on the navigation side, before providing it as an argument to the Screen. See my commit for an implementation idea.