android: compileSdk 37.1 for Compose 1.13; ktlint wraps at detekt's 120 (#8533)
release / go (push) Successful in 1m47s
release / web (push) Successful in 1m29s
release / integration (push) Successful in 2m41s
release / govulncheck (push) Successful in 19s
release / android (push) Failing after 2m19s
release / Build signed APK (push) Failing after 2m26s
release / Build + push container image (push) Skipped

Run 11504 failed in two places:
- checkReleaseAarMetadata: Compose 1.13 requires compiling against
  Android 37.1, and compileSdk 37 resolves to 37.0. It is now
  release(37) { minorApiLevel = 1 }.
- detekt:
  - 25 MaxLineLength findings, because ktlint_official wraps at 140 and
    detekt allows 120. .editorconfig now sets max_line_length = 120, so
    the two checks agree, and the sources are reformatted to it.
  - The reformat's extra line breaks pushed MinstrelForwardingPlayer past
    LargeClass. Its file-level suppression already explains that the
    class mirrors the Media3 Player surface, and it now covers size too.
  - The extra line breaks also pushed MiniRow past LongMethod. Its cover
    and title moved into MiniTrackInfo.

ktlint 1.5 and detekt 2.0.0-alpha.6 both pass locally on these sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 15:00:38 -05:00
co-authored by Claude Opus 5.5
parent 924b4537c3
commit dc9edb4fc4
20 changed files with 130 additions and 60 deletions
+7 -3
View File
@@ -1,7 +1,11 @@
# ktlint reads this. The code style is ktlint's default (ktlint_official); # ktlint reads this. The code style is ktlint's default (ktlint_official)
# the one exception is Compose's convention of naming @Composable functions # with two changes:
# like types (PlayerScreen, not playerScreen). # - Lines wrap at 120, detekt's MaxLineLength, so the two checks agree.
# ktlint_official alone would wrap at 140.
# - @Composable functions are exempt from the lowercase naming rule, because
# Compose names them like types (PlayerScreen, not playerScreen).
root = true root = true
[*.{kt,kts}] [*.{kt,kts}]
max_line_length = 120
ktlint_function_naming_ignore_when_annotated_with = Composable ktlint_function_naming_ignore_when_annotated_with = Composable
+4 -1
View File
@@ -15,7 +15,10 @@ plugins {
android { android {
namespace = "com.fabledsword.minstrel" namespace = "com.fabledsword.minstrel"
compileSdk = 37 // 37.1: Compose 1.13 requires compiling against Android 37.1 or later.
compileSdk {
version = release(37) { minorApiLevel = 1 }
}
defaultConfig { defaultConfig {
applicationId = "com.fabledsword.minstrel" applicationId = "com.fabledsword.minstrel"
@@ -23,7 +23,16 @@ class AdminInvitesRepository
suspend fun list(): List<Invite> = api.list().invites.map { it.toDomain() } suspend fun list(): List<Invite> = api.list().invites.map { it.toDomain() }
suspend fun create(note: String?): Invite = api.create(CreateInviteBody(note = note?.takeIf { it.isNotEmpty() })).toDomain() suspend fun create(note: String?): Invite =
api
.create(
CreateInviteBody(
note =
note?.takeIf {
it.isNotEmpty()
},
),
).toDomain()
suspend fun revoke(token: String) { suspend fun revoke(token: String) {
api.revoke(token) api.revoke(token)
@@ -51,4 +51,5 @@ private fun AdminTagSourceWire.toDomain(): AdminTagSourceRef =
testable = testable, testable = testable,
) )
private fun TestTagSourceWire.toResult(): TagSourceTestResult = TagSourceTestResult(ok = ok, durationMs = durationMs, error = error) private fun TestTagSourceWire.toResult(): TagSourceTestResult =
TagSourceTestResult(ok = ok, durationMs = durationMs, error = error)
@@ -139,7 +139,10 @@ class AuthController
}.join() }.join()
} }
private fun decodeUser(raw: String): UserRef? = runCatching { json.decodeFromString(UserRef.serializer(), raw) }.getOrNull() private fun decodeUser(raw: String): UserRef? =
runCatching {
json.decodeFromString(UserRef.serializer(), raw)
}.getOrNull()
private companion object { private companion object {
// Long enough for a logout on a slow connection, short enough that // Long enough for a logout on a slow connection, short enough that
@@ -57,5 +57,6 @@ class CachedTrackIds
} }
} }
private fun readKeys(): Set<String> = runCatching { playerFactory.simpleCache.keys.toSet() }.getOrDefault(emptySet()) private fun readKeys(): Set<String> =
runCatching { playerFactory.simpleCache.keys.toSet() }.getOrDefault(emptySet())
} }
@@ -37,7 +37,8 @@ class ShuffleSource
private val playerFactory: PlayerFactory, private val playerFactory: PlayerFactory,
) { ) {
/** Cached tracks, most-recently-played first (liked included). */ /** Cached tracks, most-recently-played first (liked included). */
suspend fun recentlyPlayed(limit: Int = POOL_LIMIT): List<TrackRef> = materialize(residentIdsByRecency()).take(limit) suspend fun recentlyPlayed(limit: Int = POOL_LIMIT): List<TrackRef> =
materialize(residentIdsByRecency()).take(limit)
/** Cached tracks that are in the user's liked set, recency-ordered. */ /** Cached tracks that are in the user's liked set, recency-ordered. */
suspend fun liked(limit: Int = POOL_LIMIT): List<TrackRef> { suspend fun liked(limit: Int = POOL_LIMIT): List<TrackRef> {
@@ -68,19 +68,24 @@ class HomeRepository
) )
} }
fun observeRecentlyAddedAlbums(): Flow<List<HomeTile<AlbumRef>>> = observeAlbumSection(SECTION_RECENTLY_ADDED_ALBUMS) fun observeRecentlyAddedAlbums(): Flow<List<HomeTile<AlbumRef>>> =
observeAlbumSection(SECTION_RECENTLY_ADDED_ALBUMS)
fun observeRediscoverAlbums(): Flow<List<HomeTile<AlbumRef>>> = observeAlbumSection(SECTION_REDISCOVER_ALBUMS) fun observeRediscoverAlbums(): Flow<List<HomeTile<AlbumRef>>> = observeAlbumSection(SECTION_REDISCOVER_ALBUMS)
fun observeRediscoverArtists(): Flow<List<HomeTile<ArtistRef>>> = observeArtistSection(SECTION_REDISCOVER_ARTISTS) fun observeRediscoverArtists(): Flow<List<HomeTile<ArtistRef>>> =
observeArtistSection(SECTION_REDISCOVER_ARTISTS)
fun observeMostPlayedTracks(): Flow<List<HomeTile<TrackRef>>> = observeTrackSection(SECTION_MOST_PLAYED_TRACKS) fun observeMostPlayedTracks(): Flow<List<HomeTile<TrackRef>>> = observeTrackSection(SECTION_MOST_PLAYED_TRACKS)
fun observeLastPlayedArtists(): Flow<List<HomeTile<ArtistRef>>> = observeArtistSection(SECTION_LAST_PLAYED_ARTISTS) fun observeLastPlayedArtists(): Flow<List<HomeTile<ArtistRef>>> =
observeArtistSection(SECTION_LAST_PLAYED_ARTISTS)
fun observeYouMightLikeAlbums(): Flow<List<HomeTile<AlbumRef>>> = observeAlbumSection(SECTION_YOU_MIGHT_LIKE_ALBUMS) fun observeYouMightLikeAlbums(): Flow<List<HomeTile<AlbumRef>>> =
observeAlbumSection(SECTION_YOU_MIGHT_LIKE_ALBUMS)
fun observeYouMightLikeArtists(): Flow<List<HomeTile<ArtistRef>>> = observeArtistSection(SECTION_YOU_MIGHT_LIKE_ARTISTS) fun observeYouMightLikeArtists(): Flow<List<HomeTile<ArtistRef>>> =
observeArtistSection(SECTION_YOU_MIGHT_LIKE_ARTISTS)
/** True when the index cache already has content on screen to protect. */ /** True when the index cache already has content on screen to protect. */
suspend fun hasCachedIndex(): Boolean = homeIndexDao.hasAny() suspend fun hasCachedIndex(): Boolean = homeIndexDao.hasAny()
@@ -169,10 +169,16 @@ class LibraryRepository
// missing mark is not used to build it locally. // missing mark is not used to build it locally.
/** Genre index, ordered by track count then name (server order). */ /** Genre index, ordered by track count then name (server order). */
suspend fun genres(): List<GenreCount> = api.getGenres().map { GenreCount(genre = it.genre, trackCount = it.trackCount) } suspend fun genres(): List<GenreCount> =
api.getGenres().map {
GenreCount(genre = it.genre, trackCount = it.trackCount)
}
/** Year index, newest first. Albums with no release date are absent. */ /** Year index, newest first. Albums with no release date are absent. */
suspend fun albumYears(): List<YearCount> = api.getAlbumYears().map { YearCount(year = it.year, albumCount = it.albumCount) } suspend fun albumYears(): List<YearCount> =
api.getAlbumYears().map {
YearCount(year = it.year, albumCount = it.albumCount)
}
/** One page of albums carrying [genre] on any track. */ /** One page of albums carrying [genre] on any track. */
suspend fun albumsByGenre( suspend fun albumsByGenre(
@@ -127,7 +127,10 @@ class LikesRepository
* Used by playlist/album detail screens to color a row's like * Used by playlist/album detail screens to color a row's like
* button independent of whether the track is in the local library. * button independent of whether the track is in the local library.
*/ */
fun observeLikedTrackIds(): Flow<Set<String>> = likeDao.observeLikedIdsOfType(currentUserId(), ENTITY_TRACK).map { it.toSet() } fun observeLikedTrackIds(): Flow<Set<String>> =
likeDao.observeLikedIdsOfType(currentUserId(), ENTITY_TRACK).map {
it.toSet()
}
/** /**
* The liked track ids of whoever is signed in, most recently liked * The liked track ids of whoever is signed in, most recently liked
@@ -144,10 +147,12 @@ class LikesRepository
.flatMapLatest { userId -> likeDao.observeLikedTrackIdsNewestFirst(userId) } .flatMapLatest { userId -> likeDao.observeLikedTrackIdsNewestFirst(userId) }
/** [observeSignedInLikedTrackIdsNewestFirst] as a set. */ /** [observeSignedInLikedTrackIdsNewestFirst] as a set. */
fun observeSignedInLikedTrackIds(): Flow<Set<String>> = observeSignedInLikedTrackIdsNewestFirst().map { it.toSet() } fun observeSignedInLikedTrackIds(): Flow<Set<String>> =
observeSignedInLikedTrackIdsNewestFirst().map { it.toSet() }
/** One-shot snapshot of the liked track-id set — for the offline pool filter. */ /** One-shot snapshot of the liked track-id set — for the offline pool filter. */
suspend fun likedTrackIds(): Set<String> = likeDao.observeLikedIdsOfType(currentUserId(), ENTITY_TRACK).first().toSet() suspend fun likedTrackIds(): Set<String> =
likeDao.observeLikedIdsOfType(currentUserId(), ENTITY_TRACK).first().toSet()
// ── Writes (optimistic local → best-effort REST → enqueue on fail) ── // ── Writes (optimistic local → best-effort REST → enqueue on fail) ──
@@ -7,11 +7,13 @@ package com.fabledsword.minstrel.models
* and the raw-AsyncImage cover surfaces still load it. The single * and the raw-AsyncImage cover surfaces still load it. The single
* album-cover URL builder for the whole client. * album-cover URL builder for the whole client.
*/ */
fun albumCoverPath(albumId: String): String = if (albumId.isEmpty()) "" else "http://placeholder.invalid/api/albums/$albumId/cover" fun albumCoverPath(albumId: String): String =
if (albumId.isEmpty()) "" else "http://placeholder.invalid/api/albums/$albumId/cover"
/** /**
* Absolute URL of an artist's image, or "" when [artistId] is blank. The * Absolute URL of an artist's image, or "" when [artistId] is blank. The
* server answers with the artist's picture, or else their newest album * server answers with the artist's picture, or else their newest album
* cover, through the same placeholder host as [albumCoverPath]. * cover, through the same placeholder host as [albumCoverPath].
*/ */
fun artistImagePath(artistId: String): String = if (artistId.isEmpty()) "" else "http://placeholder.invalid/api/artists/$artistId/image" fun artistImagePath(artistId: String): String =
if (artistId.isEmpty()) "" else "http://placeholder.invalid/api/artists/$artistId/image"
@@ -125,4 +125,5 @@ internal fun deliveryWanted(
internal fun pileText(count: Int): String = "$count new notifications" internal fun pileText(count: Int): String = "$count new notifications"
/** Under an expanded pile's titles: how many it holds beyond them, or null. */ /** Under an expanded pile's titles: how many it holds beyond them, or null. */
internal fun pileMore(p: Announcement.Pile): String? = (p.count - p.lines.size).takeIf { it > 0 }?.let { "and $it more" } internal fun pileMore(p: Announcement.Pile): String? =
(p.count - p.lines.size).takeIf { it > 0 }?.let { "and $it more" }
@@ -1,4 +1,7 @@
@file:Suppress("TooManyFunctions") // Mirrors Player surface: ~16 methods is the API. // Mirrors the Media3 Player surface: its ~16 methods and their remote
// (UPnP) branches are the API, so both the function count and the size
// follow from it.
@file:Suppress("TooManyFunctions", "LargeClass")
package com.fabledsword.minstrel.player package com.fabledsword.minstrel.player
@@ -60,7 +60,8 @@ class OfflineGatedDataSource(
length: Int, length: Int,
): Int = delegate.read(buffer, offset, length) ): Int = delegate.read(buffer, offset, length)
override fun addTransferListener(transferListener: TransferListener) = delegate.addTransferListener(transferListener) override fun addTransferListener(transferListener: TransferListener) =
delegate.addTransferListener(transferListener)
override fun getResponseHeaders() = delegate.responseHeaders override fun getResponseHeaders() = delegate.responseHeaders
} }
@@ -158,8 +158,15 @@ class SingleTrackLoader
if (currentIndex !in queue.indices) return@withLock PollOutcome(0, advanced = false) if (currentIndex !in queue.indices) return@withLock PollOutcome(0, advanced = false)
val moved = followRenderer(trackUri) val moved = followRenderer(trackUri)
armNext(transport) armNext(transport)
if (moved) return@withLock PollOutcome(currentIndex + 1, advanced = false, knownDurationMs(queue, currentIndex)) if (moved) {
endedOnLastPoll = endDetector.onPoll(state, positionMs, durationMs, knownDurationMs(queue, currentIndex)) return@withLock PollOutcome(
currentIndex + 1,
advanced = false,
knownDurationMs(queue, currentIndex),
)
}
endedOnLastPoll =
endDetector.onPoll(state, positionMs, durationMs, knownDurationMs(queue, currentIndex))
val next = currentIndex + 1 val next = currentIndex + 1
val advance = endedOnLastPoll && playIntent && next in queue.indices val advance = endedOnLastPoll && playIntent && next in queue.indices
if (advance) { if (advance) {
@@ -183,7 +183,8 @@ class SoapClient(
private fun faultCodeOf(body: String): String = extractBetween(body, "<errorCode>", "</errorCode>") ?: "unknown" private fun faultCodeOf(body: String): String = extractBetween(body, "<errorCode>", "</errorCode>") ?: "unknown"
private fun faultDescriptionOf(body: String): String = extractBetween(body, "<errorDescription>", "</errorDescription>").orEmpty() private fun faultDescriptionOf(body: String): String =
extractBetween(body, "<errorDescription>", "</errorDescription>").orEmpty()
private fun extractBetween( private fun extractBetween(
body: String, body: String,
@@ -195,6 +195,40 @@ private fun MiniProgressFill(
} }
} }
// Cover + title. Tapping it expands to NowPlaying; the transport buttons
// beside it don't, because each IconButton handles its own clicks. So only
// this region carries the clickable modifier, not the whole row.
@Composable
private fun MiniTrackInfo(
track: TrackRef,
onExpandClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier.clickable(onClick = onExpandClick),
verticalAlignment = Alignment.CenterVertically,
) {
MiniCover(coverUrl = track.coverUrl, contentDescription = track.title)
Spacer(Modifier.width(12.dp))
Column(modifier = Modifier.weight(1f)) {
Text(
text = track.title,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
text = track.artistName,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
}
@Composable @Composable
@Suppress("LongParameterList") @Suppress("LongParameterList")
private fun MiniRow( private fun MiniRow(
@@ -218,36 +252,11 @@ private fun MiniRow(
.padding(horizontal = 12.dp), .padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
// Cover + title area expands to NowPlaying on tap, but the MiniTrackInfo(
// transport buttons don't (each IconButton handles its own track = track,
// clicks). Wrap only the cover-and-title region with the onExpandClick = onExpandClick,
// clickable modifier rather than the whole row. modifier = Modifier.weight(1f),
Row( )
modifier =
Modifier
.weight(1f)
.clickable(onClick = onExpandClick),
verticalAlignment = Alignment.CenterVertically,
) {
MiniCover(coverUrl = track.coverUrl, contentDescription = track.title)
Spacer(Modifier.width(12.dp))
Column(modifier = Modifier.weight(1f)) {
Text(
text = track.title,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
text = track.artistName,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
LikeButton(liked = isLiked, onToggle = onToggleLike) LikeButton(liked = isLiked, onToggle = onToggleLike)
val tint = MaterialTheme.colorScheme.onSurface val tint = MaterialTheme.colorScheme.onSurface
SkipButton( SkipButton(
@@ -279,7 +279,8 @@ class PlaylistDetailViewModel
// says so and re-fetches, so the screen shows what is really there. // says so and re-fetches, so the screen shows what is really there.
/** Only the owner edits a playlist, and nobody edits a mix. */ /** Only the owner edits a playlist, and nobody edits a mix. */
fun canEdit(playlist: PlaylistRef): Boolean = !playlist.isSystem && playlist.userId == authController.currentUser.value?.id fun canEdit(playlist: PlaylistRef): Boolean =
!playlist.isSystem && playlist.userId == authController.currentUser.value?.id
fun rename(name: String) { fun rename(name: String) {
val d = shownDetail() ?: return val d = shownDetail() ?: return
@@ -185,7 +185,8 @@ class UpdateRepository(
} }
/** Where the package for [info] waits: named for its build. */ /** Where the package for [info] waits: named for its build. */
private fun waiting(info: UpdateInfo): File = File(dir, "minstrel-${info.code ?: info.version.replace(UNSAFE, "_")}.apk") private fun waiting(info: UpdateInfo): File =
File(dir, "minstrel-${info.code ?: info.version.replace(UNSAFE, "_")}.apk")
private companion object { private companion object {
const val PART = ".part" const val PART = ".part"
@@ -79,7 +79,13 @@ class DeliveryPlanTest {
listOf( listOf(
NotificationKindSettingWire("new_music", false, inbox = true, phone = false, email = true), NotificationKindSettingWire("new_music", false, inbox = true, phone = false, email = true),
NotificationKindSettingWire("tracks_missing", true, inbox = false, phone = true, email = true), NotificationKindSettingWire("tracks_missing", true, inbox = false, phone = true, email = true),
NotificationKindSettingWire("quarantine_flagged", true, inbox = true, phone = true, email = true), NotificationKindSettingWire(
"quarantine_flagged",
true,
inbox = true,
phone = true,
email = true,
),
), ),
emailAvailable = true, emailAvailable = true,
) )