DroidKaigi / conference-app-2021

The Official App for DroidKaigi 2021
https://droidkaigi.jp/
Apache License 2.0
641 stars 181 forks source link

Migrate ViewModel to hiltViewModel() in navigation compose #436

Open takahirom opened 3 years ago

takahirom commented 3 years ago

Kind (Required)

jimgoog commented 3 years ago

Preferably you would not use AAC ViewModels nor Hilt within your composables because both couple your composables to your platform/application respectively. Build your widgets with the assumption they will be cross-compiled to other platforms and used in other applications. 😉

https://twitter.com/JimSproch/status/1396429288493109248

takahirom commented 3 years ago

Thank you for your opinion. Ideally I would do that too. 👍 Currently, it is easy for an Android engineer to work with Android Navigation and ViewModel, and there are practices introduced in I/O.
Also, although not ideal, DroidKaigi uses modularization to reduce platform dependency a bit.
For details, narrow the scope where you can see Android ViewModel and Hilt as much as possible, create an interface, and make Android ViewModel invisible from the Composable function of the screen. 👀

Originally Hilt and ViewModel and Navigation are used in this app, and since the only thing that changes in this issue is the scope of ViewModel, there should be no change in terms of platform dependency.🙏