gate scrobbling behind a setting and funnel server writes through a sink

Scrobbling can be turned off in Settings (on by default). Now-playing,
scrobbles and stars all go through a ServerActionSink so a persistent
offline outbox can replace the network implementation later without
touching the callers.
This commit is contained in:
austinried
2026-10-04 00:30:04 +00:00
parent 29e5029b56
commit 0379102e24
13 changed files with 202 additions and 65 deletions
@@ -48,6 +48,11 @@ class SettingsViewModel(
.syncConcurrency()
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), DEFAULT_FETCH_CONCURRENCY)
val scrobbling: StateFlow<Boolean> =
userPreferences
.scrobbling()
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), true)
fun selectSource(id: Long) {
viewModelScope.launch { sourceRepository.selectSource(id) }
}
@@ -71,4 +76,8 @@ class SettingsViewModel(
fun setSyncConcurrency(value: Int) {
viewModelScope.launch { userPreferences.setSyncConcurrency(value) }
}
fun setScrobbling(enabled: Boolean) {
viewModelScope.launch { userPreferences.setScrobbling(enabled) }
}
}