refactor(android): route all cover getters through albumCoverPath
This commit is contained in:
@@ -48,6 +48,7 @@ import com.composables.icons.lucide.User
|
||||
import com.fabledsword.minstrel.library.widgets.AlbumCard
|
||||
import com.fabledsword.minstrel.models.ArtistDetailRef
|
||||
import com.fabledsword.minstrel.models.ArtistRef
|
||||
import com.fabledsword.minstrel.models.albumCoverPath
|
||||
import com.fabledsword.minstrel.nav.AlbumDetail
|
||||
import com.fabledsword.minstrel.shared.widgets.EmptyState
|
||||
import com.fabledsword.minstrel.shared.widgets.LikeButton
|
||||
@@ -205,7 +206,7 @@ private fun ArtistAvatar(artist: ArtistRef, fallbackAlbumId: String? = null) {
|
||||
// _ArtistAvatar). Bare Lucide.User only when neither exists.
|
||||
val model = when {
|
||||
artist.coverUrl.isNotEmpty() -> artist.coverUrl
|
||||
fallbackAlbumId != null -> "/api/albums/$fallbackAlbumId/cover"
|
||||
fallbackAlbumId != null -> albumCoverPath(fallbackAlbumId)
|
||||
else -> null
|
||||
}
|
||||
Box(
|
||||
|
||||
@@ -32,5 +32,5 @@ data class AlbumRef(
|
||||
* grid, Home rows on cold-start) would show no artwork at all.
|
||||
*/
|
||||
val displayCoverUrl: String
|
||||
get() = coverUrl.ifEmpty { "http://placeholder.invalid/api/albums/$id/cover" }
|
||||
get() = coverUrl.ifEmpty { albumCoverPath(id) }
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ data class ArtistRef(
|
||||
val displayCoverUrl: String?
|
||||
get() = when {
|
||||
coverUrl.isNotEmpty() -> coverUrl
|
||||
coverAlbumId.isNotEmpty() -> "/api/albums/$coverAlbumId/cover"
|
||||
coverAlbumId.isNotEmpty() -> albumCoverPath(coverAlbumId)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,5 @@ data class PlaylistTrackRef(
|
||||
* whose upstream album was deleted).
|
||||
*/
|
||||
val coverUrl: String
|
||||
get() = albumId?.takeIf { it.isNotEmpty() }
|
||||
?.let { "http://placeholder.invalid/api/albums/$it/cover" }
|
||||
.orEmpty()
|
||||
get() = albumCoverPath(albumId.orEmpty())
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ data class QuarantineRef(
|
||||
* Empty when the row has no album binding (rare).
|
||||
*/
|
||||
val coverUrl: String
|
||||
get() = if (albumId.isEmpty()) "" else "http://placeholder.invalid/api/albums/$albumId/cover"
|
||||
get() = albumCoverPath(albumId)
|
||||
}
|
||||
|
||||
@@ -41,5 +41,5 @@ data class TrackRef(
|
||||
* branch on isEmpty to show the placeholder icon.
|
||||
*/
|
||||
val coverUrl: String
|
||||
get() = if (albumId.isEmpty()) "" else "http://placeholder.invalid/api/albums/$albumId/cover"
|
||||
get() = albumCoverPath(albumId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user