fix(home): buildSongsLikeRow ReturnCount ≤ 2 (detekt)
android / Build + lint + test (push) Failing after 3m4s
android / Build + lint + test (push) Failing after 3m4s
Collapse the three early returns into a single `when` expression — detekt's ReturnCount capped at 2. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1094,13 +1094,15 @@ internal fun buildSongsLikeRow(
|
|||||||
offline: Boolean,
|
offline: Boolean,
|
||||||
): List<PlaylistRowItem> {
|
): List<PlaylistRowItem> {
|
||||||
val mixes = owned.filter { it.systemVariant == "songs_like_artist" }
|
val mixes = owned.filter { it.systemVariant == "songs_like_artist" }
|
||||||
if (offline) {
|
return when {
|
||||||
val (available, greyed) = mixes.partition { !it.unavailableOffline }
|
offline -> {
|
||||||
return (available + greyed).map { PlaylistRowItem.Real(it) }
|
val (available, greyed) = mixes.partition { !it.unavailableOffline }
|
||||||
}
|
(available + greyed).map { PlaylistRowItem.Real(it) }
|
||||||
if (mixes.isNotEmpty()) return mixes.map { PlaylistRowItem.Real(it) }
|
}
|
||||||
return List(SONGS_LIKE_PLACEHOLDER_SLOTS) {
|
mixes.isNotEmpty() -> mixes.map { PlaylistRowItem.Real(it) }
|
||||||
PlaylistRowItem.Placeholder("Songs like…", variantFor("songs-like", status))
|
else -> List(SONGS_LIKE_PLACEHOLDER_SLOTS) {
|
||||||
|
PlaylistRowItem.Placeholder("Songs like…", variantFor("songs-like", status))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user