AppState Class Contradicts the definition in the official Guide to App Architecture Documentation

Open
#1,973 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Quiet
Tech stack
android, kotlin
Domain
mobile

Research direction

Start by reading the StateHolder guide and the NiaAppState entry point mentioned in the issue, along with its references to UserNewsResourceRepository, NetworkMonitor, and TimeZoneMonitor. Compare the implementation with the guide and document whether the current design is intentional; done requires a decided architectural direction, not just a code change.

Written by the indexing model from the issue text.

Description

I noticed the StateHolder guide
describes plain class state holders as UI-only, without business logic. But in the Now in Android code, NiaAppState:

directly references UserNewsResourceRepository, NetworkMonitor, and TimeZoneMonitor (i.e. data layer)

computes derived state related to “unread resources” (some business logic)

is instantiated via remember, not through a ViewModel

So NiaAppState is not a pure “plain class state holder” per the guide. It behaves more like an app-level UI coordinator / state orchestrator, combining UI logic with lightweight access to domain data for navigation and cross-feature state.

Could you clarify:

  1. Was NiaAppState deliberately designed this way (blending data and UI logic) for sample simplicity or is there another architectural reason?

  2. In your view, should some of the data access / business-logic portions be moved to a ViewModel or domain layer instead?

I can also propose a stricter refactoring version that aligns more closely with the guide’s architecture!

Dominant language
Kotlin
Stars
22.1k
Forks
4.7k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/nowinandroid

All issues in android/nowinandroid

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.