horologist icon indicating copy to clipboard operation
horologist copied to clipboard

Decouple PlayerViewModel

Open fstanis opened this issue 2 years ago • 0 comments

WHAT

Separates most PlayerViewModel logic into a plain class.

WHY

This makes it easier to implement a PlayerViewModel without having a subclass a ViewModel for niche use-cases, e.g. multiple players in a single ViewModel. Also makes testing slightly easier.

HOW

Moves most logic that doesn't require a lifecycle from PlayerViewModel into PlayerUiStateProducer and adds a PlayerUiController interface (which PlayerViewModel implements) so that composables like DefaultPlayerScreenControlButtons wouldn't need to receive a PlayerViewModel (but still can).

Checklist :clipboard:

  • [X] Add explicit visibility modifier and explicit return types for public declarations
  • [X] Run spotless check
  • [X] Run tests
  • [X] Update metalava's signature text files

fstanis avatar Sep 22 '22 17:09 fstanis