The first public release of Fabled Minstrel #158

Merged
bvandeusen merged 256 commits from dev into main 2026-12-03 21:41:58 -05:00
4 changed files with 11 additions and 12 deletions
Showing only changes of commit 5853c52640 - Show all commits
@@ -133,9 +133,6 @@ class AlbumDetailViewModel @Inject constructor(
}
fun toggleLikeTrack(trackId: String) {
val desired = trackId !in likedTrackIds.value
viewModelScope.launch {
likes.toggleLike(LikesRepository.ENTITY_TRACK, trackId, desired)
}
viewModelScope.launch { likes.toggleTrackLike(trackId, likedTrackIds.value) }
}
}
@@ -148,6 +148,14 @@ class LikesRepository @Inject constructor(
// ── Writes (optimistic local → best-effort REST → enqueue on fail) ──
/**
* Flips a track's like, reading whether it is liked now from [likedIds],
* the set the screen is already showing. The heart buttons on track lists
* (an album, a playlist, the player) call this.
*/
suspend fun toggleTrackLike(trackId: String, likedIds: Set<String>): Boolean =
toggleLike(ENTITY_TRACK, trackId, desiredState = trackId !in likedIds)
/**
* Toggle like state for [entityType]/[entityId]. UI doesn't need to
* await this; the Flow re-emits immediately from the optimistic
@@ -61,10 +61,7 @@ class PlayerViewModel @Inject constructor(
fun clearQueue() = controller.clearQueue()
fun toggleLikeTrack(trackId: String) {
val desired = trackId !in likedTrackIds.value
viewModelScope.launch {
likes.toggleLike(LikesRepository.ENTITY_TRACK, trackId, desired)
}
viewModelScope.launch { likes.toggleTrackLike(trackId, likedTrackIds.value) }
}
}
@@ -228,10 +228,7 @@ class PlaylistDetailViewModel @Inject constructor(
}
fun toggleLikeTrack(trackId: String) {
val desired = trackId !in likedTrackIds.value
viewModelScope.launch {
likes.toggleLike(LikesRepository.ENTITY_TRACK, trackId, desired)
}
viewModelScope.launch { likes.toggleTrackLike(trackId, likedTrackIds.value) }
}
/**