fix: Refresh stale data when the app comes back from the background #30
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/refresh-on-resume"
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?
What was wrong
TVs keep LiveWire running when you close it, so reopening it resumes the same screen instead of starting fresh. Home, the Guide and Sports only checked whether their data was out of date when the screen first appeared, which never happens on a resume. The channels and guide stayed old until a force quit.
Home also skipped reloading now-playing on a stale refresh when the channel list hadn't changed, which is the usual case after a few hours away.
What changed
HomeScreen,GuideScreen,SportsScreen: the "screen shown" call moves fromLaunchedEffect(Unit)toLifecycleStartEffect, so it also runs when the app returns to the foreground. The existing freshness windows still decide whether anything downloads (Home 10 min, Guide 30 min), so a quick return or coming back from the player costs nothing.HomeViewModel.refreshIfStale: always reloads the guide (now-playing), and only rebuilds the lists when they changed.Verified
testDebugUnitTestandlintDebugpass.