clear the compile warnings the downloads work left behind

- ArtworkStore's fetcher still did `response.body ?: throw` from before the body
  size limit landed; OkHttp's `body` is not nullable, so the elvis was dead.
- DownloadRepository's `downloadStates` uses `flatMapLatest` without the opt-in
  its callers annotate.
- HeroHeader's subtitle tap invoked `onSubtitleClick?.invoke()` inside the branch
  where it is already known to be non-null.
- MediaItemTest used a safe call on `clippingConfiguration`, which never returns
  null.

No behaviour change: a clean full rebuild now compiles without warnings.
This commit is contained in:
austinried
2026-10-04 00:30:01 +00:00
parent 6a311638c2
commit d710a3185c
4 changed files with 6 additions and 4 deletions
@@ -85,7 +85,7 @@ class OkHttpArtworkFetcher(
val request = Request.Builder().url(url).build()
http.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Artwork request failed with ${response.code}")
val body = response.body ?: throw IOException("Artwork response had no body")
val body = response.body
if (body.contentLength() > maxBytes) throw IOException("Artwork response is larger than $maxBytes bytes")
val source = body.source()
source.request(maxBytes + 1)
@@ -16,6 +16,7 @@ import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
@@ -157,6 +158,7 @@ class DownloadRepository(
resumed.forEach { fetchArtworkSafely(it.sourceId, it.songId) }
}
@OptIn(ExperimentalCoroutinesApi::class)
private fun downloadStates(): Flow<Map<String, SongDownload>> =
sourceRepository
.activeSourceId()
@@ -253,7 +253,7 @@ fun HeroHeader(
modifier =
Modifier
.heightIn(min = 32.dp)
.clickable(onClickLabel = "Open artist") { onSubtitleClick?.invoke() },
.clickable(onClickLabel = "Open artist") { onSubtitleClick() },
contentAlignment = Alignment.TopCenter,
) {
HeroSubtitle(subtitle, Modifier.padding(top = 4.dp))