Skip to content

Arch: introduce repository interfaces between ViewModels and DAOs #46

Description

@Yokomoko

From: review-reports/architect.md finding #2, SUMMARY.md Theme B

Where: every ViewModel (HomeVM, LiveVM, MovieDetailVM, ShowDetailVM, SearchVM, SettingsVM) injects raw Room DAOs — up to 7 per VM.

Issue: No repository layer between UI and data layers. Swapping TMDB for OMDb, adding a second playlist, schema migrations, or offline mode require shotgun edits across every ViewModel. LiveViewModel even exposes programmeDao as internal val so GuideGridScreen can reach past the ViewModel to Room directly — violates unidirectional data flow.

Fix (incremental): start with the 3-4 busiest DAOs:

  • MovieRepository (wraps MovieDao)
  • SeriesRepository (wraps SeriesDao + EpisodeDao)
  • ChannelRepository (wraps ChannelDao)
  • ContentRepository (wraps ContentDao)

Interfaces declared in domain/, Room-backed implementations in data/repo/. Hilt binds interface → impl. ViewModels depend on interfaces. Don't try to cover all 11 DAOs at once.

Also fixes: Idioms #8 (LiveViewModel exposing programmeDao) — GuideGridScreen gets a suspend fn or Flow from the repo, not a DAO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsecondary-priorityHigh value — noticeably improves the experience

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions