Spikeysanju/Expenso

Refactoring TransactionViewModel

yash-k9 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
TransactionViewModel is extending AndroidViewModel which takes in application context and requires a viewmodelFactory to be initialized. In the viewmodel, I observed that only UiModeDataStore is using the application context which can be directly injected by Hilt

Describe the solution you'd like
Instead of using the AndroidViewModel, we can extend to ViewModel and Inject the UiModeDataStore directly through constructor. This will also eliminate the use of the viewmodelFactory

Describe alternatives you've considered
I've refactored the code and the behaviour is as expected. I can raise a PR if this change is approved.

@yash-k9 Thanks for bringing this up. Yes I agreed with your statement. Feel free to create a PR for this 👍 .