File tree Expand file tree Collapse file tree
app/src/main/kotlin/com/metrolist/music/features/canvas Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com.metrolist.music.features.canvas
2+
3+ import kotlinx.coroutines.flow.MutableStateFlow
4+ import kotlinx.coroutines.flow.StateFlow
5+ import kotlinx.coroutines.flow.asStateFlow
6+ import kotlinx.coroutines.flow.update
7+ import java.util.concurrent.ConcurrentHashMap
8+
9+ /* * In-memory per-track selections made from the Player's Canvas picker. */
10+ object CanvasArtworkSelectionStore {
11+ private val selected = ConcurrentHashMap <String , CanvasArtwork >()
12+ private val _changes = MutableStateFlow (0L )
13+ val changes: StateFlow <Long > = _changes .asStateFlow()
14+
15+ fun get (mediaId : String ): CanvasArtwork ? = selected[mediaId]
16+
17+ fun put (mediaId : String , artwork : CanvasArtwork ) {
18+ if (mediaId.isBlank()) return
19+ selected[mediaId] = artwork
20+ _changes .update { it + 1L }
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments