Android: split StreamViewModel, which implements twelve interfaces #333

Closed
opened 2026-10-25 17:21:35 +01:00 by agentic-developer · 0 comments
Collaborator

StreamViewModel implements RepositoryActions, Capturing, StreamReading, StateLists, Timesheets, Activities, Overviews, Notes, ChangesActions, Configuring and WorkingTime. Each method mostly forwards to session.value?.x(..., Instant.now()) ?: X.Failed(NO_STREAM), sometimes followed by written(id). App then takes about 13 parameters that are all this same object.

Proposal

  • Give each concern its own small adapter over Streamd (or over StreamSession plus the clock and RepositoryConnection.written): states, timesheets, activities, notes, configuration, capture.
  • Hand App one holder of them (for example AppActions) instead of thirteen parameters.
  • Keep one view model for the lifecycle: the StateFlows and viewModelScope.
  • Write the "no stream" and "commit after a write" wrapping once.

Related: the action interfaces live in three places (separate ticket).

Found in a review of the Android app.

`StreamViewModel` implements `RepositoryActions`, `Capturing`, `StreamReading`, `StateLists`, `Timesheets`, `Activities`, `Overviews`, `Notes`, `ChangesActions`, `Configuring` and `WorkingTime`. Each method mostly forwards to `session.value?.x(..., Instant.now()) ?: X.Failed(NO_STREAM)`, sometimes followed by `written(id)`. `App` then takes about 13 parameters that are all this same object. **Proposal** - Give each concern its own small adapter over `Streamd` (or over `StreamSession` plus the clock and `RepositoryConnection.written`): states, timesheets, activities, notes, configuration, capture. - Hand `App` one holder of them (for example `AppActions`) instead of thirteen parameters. - Keep one view model for the lifecycle: the `StateFlow`s and `viewModelScope`. - Write the "no stream" and "commit after a write" wrapping once. Related: the action interfaces live in three places (separate ticket). Found in a review of the Android app.
Sign in to join this conversation.
No labels
android
cli
epic
planned
tui
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
kfickel/streamd#333
No description provided.