The first public release of Fabled Minstrel #158
@@ -9,6 +9,7 @@ import com.fabledsword.minstrel.connectivity.NetworkStatusController
|
||||
import com.fabledsword.minstrel.connectivity.recoveries
|
||||
import com.fabledsword.minstrel.library.data.LibraryRepository
|
||||
import com.fabledsword.minstrel.likes.data.LikesRepository
|
||||
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||
import com.fabledsword.minstrel.models.AlbumDetailRef
|
||||
import com.fabledsword.minstrel.models.AlbumRef
|
||||
import com.fabledsword.minstrel.nav.AlbumDetail
|
||||
|
||||
@@ -151,14 +151,6 @@ 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
|
||||
@@ -254,3 +246,11 @@ class LikesRepository @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LikesRepository.toggleTrackLike(trackId: String, likedIds: Set<String>): Boolean =
|
||||
toggleLike(LikesRepository.ENTITY_TRACK, trackId, desiredState = trackId !in likedIds)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.fabledsword.minstrel.player.ui
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.fabledsword.minstrel.likes.data.LikesRepository
|
||||
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||
import com.fabledsword.minstrel.player.PlayerController
|
||||
import com.fabledsword.minstrel.player.PlayerUiState
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
|
||||
+1
@@ -66,6 +66,7 @@ import com.fabledsword.minstrel.connectivity.NetworkStatusController
|
||||
import com.fabledsword.minstrel.connectivity.recoveries
|
||||
import com.fabledsword.minstrel.events.EventsStream
|
||||
import com.fabledsword.minstrel.events.LiveEvent
|
||||
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||
import com.fabledsword.minstrel.models.PlaylistRef
|
||||
import com.fabledsword.minstrel.models.PlaylistTrackRef
|
||||
import com.fabledsword.minstrel.models.TrackRef
|
||||
|
||||
+2
-1
@@ -49,6 +49,7 @@ class SendOrQueueTest {
|
||||
|
||||
@Test
|
||||
fun `the replayer and the live write agree on what is worth retrying`() {
|
||||
assertEquals(listOf(408, 429, 500, 503), listOf(400, 403, 404, 408, 409, 429, 500, 503).filter(::isRetryableStatus))
|
||||
val statuses = listOf(400, 403, 404, 408, 409, 429, 500, 503)
|
||||
assertEquals(listOf(408, 429, 500, 503), statuses.filter(::isRetryableStatus))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user