Unify offline detection + offline playlist UX (NetworkStatusController) #86
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Collapses three half-systems that each answered a different connectivity question into one signal-driven authority, fixes the sticky offline banner, and reworks the offline playlist surface.
What changed
One authority. New
NetworkStatusControllerabsorbs the formerVersionCheckController(/healthzpoll + version parse) andServerHealthController(tri-state derive). Every consumer — banner, Home, Playlists list, search,OfflineGatedDataSource,TrackRow,LocalServerHealth— now reads its singlestate.ConnectivityObserverremains only as the thin device-link input it feeds on. A pure, unit-testedReachabilityMachineholds the state logic.Signal-driven, corroborated. Inputs: device-link transitions (link-return → immediate probe), an adaptive
/healthzpoll (calm when healthy, fast when degraded),reportSuccess()/reportFailure()from an OkHttp interceptor + the audio data source + the playback-error reporter, andrecheck()from pull-to-refresh.Healthy./healthzprobe; corroborated →ServerDown, probe-ok → stayHealthy(one bad track ≠ false offline).Sticky banner fixed. Recovery was bound to the 5-min poll; now link-return and any successful op flip to
Healthyin seconds. The banner reads the controller directly (noWhileSubscribedstaleness).New non-gating
Unstablestate → a mild "Reconnecting…" banner during the arbitration window; never gates playback or flips a screen offline. Plus a transient "Back online" recovery flash.Offline playlist UX.
PlaylistRef.fullyCached(DAO LEFT-JOIN overcached_playlist_tracks×audio_cache_index); tiles that can't be played offline (refreshable || !fullyCached) grey out but stay tappable; the offline Playlists row leads with the Recently-played / Liked pools, orders available-before-greyed, and drops not-yet-generated placeholders. Home + Playlists-list now deriveofflinefrom the unified controller (so they react toServerDown, not just the device link).Tests
New JVM unit suites run in CI:
ReachabilityMachineTest(state machine),PlaylistsRepositoryCacheMergeTest(fullyCached),BuildPlaylistsRowTest(offline ordering).Test plan (on device)
🤖 Generated with Claude Code