From a23e2e36caad16ac09e2c8a99d2bbec7f3ffc53f Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 20 Jun 2026 15:46:35 -0400 Subject: [PATCH] feat(android/home): refresh Home on playlist.system_rebuilt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parity with the web SSE consumer (5a80a1e4). HomeViewModel now subscribes to EventsStream and re-pulls Home (refreshIndex + system-playlist status) when the server emits playlist.system_rebuilt — the daily 03:00 rebuild or a manual refresh — so the system-playlist tiles and You-might-like rows reflect the new snapshot without a manual reload. Browse-only: the active playback queue is left to self-heal on the failure path. Issue #968. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../com/fabledsword/minstrel/home/ui/HomeScreen.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt index e3d047fb..598b88c1 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt @@ -95,6 +95,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.flow.filter import kotlinx.coroutines.launch import javax.inject.Inject @@ -139,6 +140,7 @@ class HomeViewModel @Inject constructor( private val libraryRepository: LibraryRepository, private val player: com.fabledsword.minstrel.player.PlayerController, private val shuffleSource: com.fabledsword.minstrel.cache.ShuffleSource, + private val eventsStream: com.fabledsword.minstrel.events.EventsStream, networkStatus: com.fabledsword.minstrel.connectivity.NetworkStatusController, ) : ViewModel() { @@ -167,6 +169,15 @@ class HomeViewModel @Inject constructor( init { refresh() + // #968: the daily 03:00 rebuild (and manual refresh) emit + // playlist.system_rebuilt; re-pull Home so the system-playlist tiles + // and You-might-like rows reflect the new snapshot without a manual + // reload. Mirrors the web SSE consumer. + viewModelScope.launch { + eventsStream.events + .filter { it.kind == "playlist.system_rebuilt" } + .collect { refresh() } + } } /**