AniTrend/anitrend-v2

Simplify view model and view model state abstraction

wax911 opened this issue · 0 comments

AniTrend Issue Guidelines

Before opening a new issue, please take a moment to review our community guidelines to make the contribution process easy and effective for everyone involved.

You may find an answer in already closed issues:
https://github.com/AniTrend/anitrend-v2/issues?q=is%3Aissue+is%3Aclosed

Feature Information

Our current implementation of ViewModel and ViewModelState has a lot of duplication which can be better abstract away behind the existing abstractions.

Solution Information

  • Move the all the implementations of ISupportViewModelState and the useCaseResult mutable live data objects and abstract them away into AniTrendViewModelState
  • Remove hooks and onClear events for AniTrendViewModelState into a new abstraction that will be called AniTrendViewModel that replaces all qualified references of ViewModel, this will have one argument constructor argument called state of the abstract type of AniTrendViewModelState<*>.
  • Refactor [app-core] view model extensions for hook to only expect one argument as part of a Single responsibility revamp to enforce one state per view model

Additional Context

N/A