Closes the last ComingSoon stub in the nav graph. Queue route now
renders the live PlayerController queue with the active row
highlighted; tap a row to jump to that position via the new
seekToIndex transport method.
New:
- player/ui/QueueScreen.kt — Scaffold + back-button AppBar; reads
the same PlayerViewModel that powers MiniPlayer / NowPlaying so
queue state stays in sync across all three. Active row gets a
12% primary-tinted background + Volume2 leading icon so the user
sees where they are. Empty queue shows "Queue is empty" hint.
Modified:
- player/PlayerController.kt — adds `seekToIndex(index: Int)`:
bounds-checked jump to a queue position via
MediaController.seekTo(mediaItemIndex, 0L) + auto-play.
- player/ui/PlayerViewModel.kt — exposes seekToIndex pass-through.
- player/ui/NowPlayingScreen.kt — takes navController now; adds a
ListMusic icon button below the transport row that navigates to
Queue.
- nav/MinstrelNavGraph.kt — Queue route renders QueueScreen;
NowPlaying composable threads navController. Drops the
ComingSoon helper + its EmptyState import — every route now has
a real screen, no stub fallback needed.
Closes Phase 16. Every named v2026.05.21.0 route has a working
native screen now.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DatabaseModule's whole job is to host one @Provides per DAO; the
12/11 trip is structural, not a smell. Adding a second module file
to split DAO providers arbitrarily by family would be busier work,
not cleaner. Suppress with a comment that explains why.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SyncController constructor injection failed — SyncMetadataDao
existed on AppDatabase but had no per-DAO bridge in DatabaseModule
(no consumer until SyncController landed). Same fix as the earlier
CachedHomeIndexDao + CachedLikeDao + CachedMutationDao pattern.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the Library-tabs-start-empty gap. Mirrors
`flutter_client/lib/cache/sync_controller.dart`, scoped to artist /
album / track only (likes refresh via /api/likes/ids; playlists pull
on screen visit). The full multi-entity sync is overkill for v1
native.
New:
- models/wire/SyncResponseWire.kt — SyncArtistWire +
SyncAlbumWire + SyncTrackWire (raw DB-row shape returned by
/api/library/sync; distinct from the regular API's display
shapes which include derived album_count / cover_url etc.).
Plus SyncUpsertsWire / SyncDeletesWire / SyncResponseWire
envelopes.
- api/endpoints/SyncApi.kt — Retrofit GET /api/library/sync.
Returns Response<...> so the controller can branch on 200 /
204 (no changes since cursor) / 410 (cursor too old, wipe +
retry) without HttpException catches.
- cache/sync/SyncController.kt — @Singleton. Self-starting: on
construction subscribes to AuthStore.sessionCookie and fires
syncSafe() whenever it transitions to a non-null value (fresh
sign-in OR cold start with persisted cookie). Applies upserts
via the existing upsertAll DAO methods, applies deletes via
deleteByIds. Cursor + lastSyncAt persisted in sync_metadata so
the next sync resumes from the new watermark.
On 410 (server compaction window exceeded), resets the cursor
to 0 and recurses; the next response carries the full entity
set, which upsertAll overwrites with. Stale rows for entities
the server no longer knows about linger until a later 410 or
app-data-clear — acceptable for v1.
Modified:
- MinstrelApplication.kt — adds @Inject lateinit var
syncController (same construct-the-singleton trick used for
ResumeController). Without the @Inject the Hilt graph would
never instantiate the controller and its init {} cookie
observer wouldn't subscribe.
Likes / playlists / playlist_tracks deltas from the same endpoint
are deferred. Their dedicated refresh paths already populate the
local cache; folding them into the sync flow is an opportunistic
optimization, not an MVP gap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the silent gap where there was no UI to like anything.
Now the Liked tab can actually grow from in-app actions, not just
from the /api/likes/ids sync seed.
New:
- shared/widgets/LikeButton.kt — heart toggle composable.
Caller-owned state: (liked: Boolean, onToggle: () -> Unit).
Tinted with M3 primary slot on liked, onSurfaceVariant on
unliked — tracks the light/dark theme without per-mode branches.
Modified:
- library/ui/AlbumDetailViewModel.kt — injects LikesRepository;
exposes `albumLiked: StateFlow<Boolean>` (observeIsLiked for the
album) + `likedTrackIds: StateFlow<Set<String>>` (observeLikedTracks
mapped to a Set for O(1) row-level lookup). `toggleLikeAlbum()` +
`toggleLikeTrack(id)` route through the repo's optimistic-write +
MutationQueue path.
- library/ui/AlbumDetailScreen.kt — LikeButton on the header next
to the cover/title block, LikeButton on every track row after
the duration. Track row vertical padding tightened from 12dp →
8dp to give the heart breathing room.
- library/ui/ArtistDetailViewModel.kt — injects LikesRepository;
exposes `artistLiked: StateFlow<Boolean>` + `toggleLikeArtist()`.
- library/ui/ArtistDetailScreen.kt — LikeButton on the header
between the name column and Play button.
PlaylistDetail per-track likes follows in a small follow-up — same
pattern, just hadn't been integrated yet.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the Search-route ComingSoon stub with the real
three-facet search. Mirrors `flutter_client/lib/search/search_screen.dart`.
New:
- models/wire/SearchWire.kt — three concrete PagedXxxWire types
(Artists / Albums / Tracks) wrapping the server's Page[T] envelope,
plus SearchResponseWire. Going non-generic on the paged wrapper is
fine — three call sites and the explicit types read clearer than
a generic with manual type-arg gymnastics at decode time.
- models/SearchResponseRef.kt — domain envelope with `isEmpty` for
the screen's "no matches" branch.
- api/endpoints/SearchApi.kt — Retrofit GET /api/search with q +
limit + offset.
- search/data/SearchRepository.kt — trivial wire→domain mapper;
debouncing intentionally lives in the VM.
- search/ui/SearchViewModel.kt — 250ms debounce on the query Flow
via debounce() + distinctUntilChanged(). Empty query collapses
to Idle without firing a request. `playTrack(track)` queues a
single track via PlayerController for the same single-row-play
pattern as HistoryTab.
- search/ui/SearchScreen.kt — auto-focus the field on entry (the
user typed Search to start typing), inline X button to clear.
Results render as three sections (Artists / Albums / Tracks),
each section omitted when its list is empty. Artist taps →
ArtistDetail, album taps → AlbumDetail, track taps → play.
Modified:
- nav/MinstrelNavGraph.kt — Search route renders the real screen.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the ArtistDetail-route ComingSoon stub with the real artist
view. Mirrors `flutter_client/lib/library/artist_detail_screen.dart`.
New:
- models/ArtistDetailRef.kt — ArtistRef + albums pair.
- library/ui/ArtistDetailViewModel.kt — VM + UiState. `playArtist()`
fires GET /api/artists/{id}/tracks and dumps the whole list into
the player queue (`source = "artist:$id"`). Errors are silent for
now — the play button has no inline error affordance.
- library/ui/ArtistDetailScreen.kt — Scaffold + back-button AppBar.
Header is a full-width LazyVerticalGrid spanning row with
circular avatar + name + album count + Play button; below it,
the albums tile out as an adaptive 176dp grid using the existing
AlbumCard.
Modified:
- library/data/LibraryRepository.kt — refreshArtistDetail now
returns ArtistDetailRef (mirroring AlbumDetail). Adds
fetchArtistTracks() for the Play button.
- nav/MinstrelNavGraph.kt — ArtistDetail route renders the real
screen; drops the now-unused androidx.navigation.toRoute import
(all detail routes use SavedStateHandle.toRoute via the VM now).
Closes Phase 12. Like buttons on detail headers + per-track + shuffle
mode on the player are open follow-ups but don't block MVP nav.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the AlbumDetail-route ComingSoon stub with the real album
view. Mirrors `flutter_client/lib/library/album_detail_screen.dart`.
New:
- models/AlbumDetailRef.kt — AlbumRef + tracks pair returned by
refreshAlbumDetail.
- library/ui/AlbumDetailViewModel.kt — VM + UiState. Pulls album
detail on init via LibraryRepository.refreshAlbumDetail (now
returning AlbumDetailRef directly so we can render from the wire
response without waiting for Room emission). `play(startTrackId)`
builds the player queue with `source = "album:$id"` so the
server's rotation reporter can advance it.
- library/ui/AlbumDetailScreen.kt — Scaffold + TopAppBar with back
button; cover + title + artist + Play/Shuffle action row; LazyColumn
of TrackRow tiles (#, title, artist, duration; tap plays from
that position). Shuffle currently fires the same play path —
player-level shuffle is a follow-up once PlayerController.setQueue
grows a shuffle flag.
Modified:
- library/data/LibraryRepository.kt — refreshAlbumDetail now
returns AlbumDetailRef. Existing callers (the LibraryRepositoryTest)
ignore the return value, no breakage.
- nav/MinstrelNavGraph.kt — AlbumDetail route renders the real
screen; id flows via SavedStateHandle.toRoute() inside the VM,
so the composable block is a one-liner.
ArtistDetail follows in the next commit within this phase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the auth loop. Settings shows the signed-in username and
server URL, and the sign-out button drops the cookie + clears
currentUser + best-effort POSTs /api/auth/logout.
New:
- settings/ui/SettingsViewModel.kt — VM + SettingsState (server URL,
username, signing-out spinner, signed-out latch).
- settings/ui/SettingsScreen.kt — three cards: Account (signed-in
username + server URL), About (Minstrel + version from
BuildConfig.VERSION_NAME + VERSION_CODE), Sign out (error-tinted
button that spins while in-flight). On signed-out, navigates to
ServerUrl with `popUpTo(0) { inclusive = true }` so the back
stack is empty.
Modified:
- nav/MinstrelNavGraph.kt — Settings route renders the real screen.
Closes Phase 11 modulo cross-restart user-identity persistence —
the cookie survives but `currentUser` is in-memory only, so a fresh
launch with an existing cookie leaves the username blank until the
next sign-in. That's the only known gap; queued as a small
AuthSessionEntity schema add when it surfaces.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cold launch now lands on the right screen based on persisted auth
state instead of always starting at Home.
New:
- auth/ui/AuthGateViewModel.kt — one-shot StateFlow that resolves
the initial NavHost destination from AuthSessionDao directly
(not AuthStore.sessionCookie, which is null until Room's first
async emission). Three outcomes:
no row at all → ServerUrl
row with default URL and no cookie → ServerUrl
row with cookie absent / empty → Login
row with cookie present → Home
- auth/ui/ServerUrlScreen.kt — VM + Screen in one file (still under
the function-count cap). Validates `http(s)://` prefix +
non-empty, trims trailing slash before persisting. On success
navigates to Login and pops ServerUrl off the back stack.
Modified:
- MainActivity.kt — wraps the NavGraph in an App() composable that
reads the AuthGateViewModel. Renders a centered spinner
(BootSplash) while the gate resolves; once resolved, hands the
decision to MinstrelNavGraph as `startDestination`.
- nav/MinstrelNavGraph.kt — startDestination is now a parameter
(was hardcoded to Home). ServerUrl route renders the real screen
instead of ComingSoon.
Settings (with sign-out) is Commit C; cross-restart user identity
persistence + auth-error 401 redirect handling are later refinements.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LoginScreen body was 76 lines vs the 60 cap. Pulled the centered
Column into LoginForm() and the spin-aware Button into SubmitButton().
LoginScreen is back to ~20 lines (LaunchedEffect + Box around LoginForm).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Foundation of the auth flow. POST /api/auth/login lands the user with
their session cookie captured by the existing AuthCookieInterceptor;
LoginScreen drives it, AuthController owns the in-memory currentUser.
New:
- models/wire/AuthWire.kt — LoginRequestBody + LoginResponseWire +
UserWire. The response `token` is duplicated for header-auth
clients; we use the Set-Cookie capture path instead.
- models/UserRef.kt — caller-facing identity (no password hash, no
api token, no Subsonic password). Matches the server's UserView
envelope.
- api/endpoints/AuthApi.kt — Retrofit POST /api/auth/login +
/api/auth/logout.
- auth/AuthController.kt — @Singleton facade. `currentUser`
StateFlow + `isSignedIn` (read straight off AuthStore.sessionCookie).
`signIn(username, password)` posts the login, surfaces the typed
UserRef. `signOut()` clears the cookie locally and best-effort
POSTs /logout (swallowed network failure — local state already
cleared, the server session times out on its own).
Cross-restart caveat: cookie persists in AuthStore but currentUser
is in-memory only — UI stays signed in across restarts but can't
render the username until a follow-up sign-in. Persisting user
JSON on AuthSessionEntity is a follow-up if it matters.
- auth/ui/LoginViewModel.kt — VM + LoginFormState (username +
password fields + submitting + error + signedIn flag). `submit()`
is a no-op while in-flight or with empty fields.
- auth/ui/LoginScreen.kt — centered form with two OutlinedTextFields
+ a Sign-in button that spins while in-flight. Error message
surfaces under the password field. On `signedIn = true` flips,
navigates to Home and pops Login off the back stack.
Modified:
- nav/MinstrelNavGraph.kt — Login route renders the real screen;
outsideShell extension now takes navController so it can be
threaded down (LoginScreen needs it for the post-sign-in nav).
ServerUrl screen + Settings + auth-gated redirect logic come in
Commits B / C.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AdminUsersScreen body was 65 lines vs the 60 cap because both
dialogs were rendered inline. Pulled them into a single
PendingDialogs helper that takes the two nullable selections + the
clear/confirm callbacks. AdminUsersScreen is back to ~45 lines and
PendingDialogs is ~30.
File function count is still 8 (Screen + UserList + UserRow +
ToggleRow + PendingDialogs + ResetPasswordDialog + DeleteConfirmDialog
+ LoadingCentered), under the 11 cap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lands the final two admin slices, closing Phase 10. Mirrors
`flutter_client/lib/admin/admin_users_screen.dart`,
`admin_landing_screen.dart`, and the `AdminUsersController` +
`adminCountsProvider` pieces of `admin_providers.dart`.
New:
- models/wire/AdminUserWire.kt — AdminUserWire + AdminUsersListWire
(server wraps the list in `{"users": [...]}`).
- models/AdminUserRef.kt — domain.
- api/endpoints/AdminUsersApi.kt — Retrofit list + setAdmin +
setAutoApprove + resetPassword + delete. PUT-auto-approve body
field is `auto_approve` (NOT `auto_approve_requests`) — matches
`internal/api/admin_users.go adminAutoApproveReq` and Flutter's
same-name workaround.
- admin/data/AdminUsersRepository.kt — list + four mutation methods.
- admin/ui/AdminUsersViewModel.kt — VM + UiState. Optimistic patch()
helper for the toggles (last-admin-guard rollback via refresh).
Delete is optimistic-remove with same rollback path. resetPassword
is fire-and-forget — server has no rollback for this anyway.
- admin/ui/AdminUsersScreen.kt — list of rows, each with two toggle
rows (Admin / Auto-approve) and Reset-password + Delete affordances.
Both are dialog-gated (typed-new-password / typed-confirm) so a
tap can't blow up an account by accident.
- admin/ui/AdminLandingScreen.kt — VM + counts + Screen. Fans out
to all three admin repositories in parallel via async/await inside
a coroutineScope; surfaces counts in three ElevatedCard tiles
(Requests / Quarantine / Users) that navigate to the slice screens.
Modified:
- nav/MinstrelNavGraph.kt — Admin + AdminUsers routes now render
their real screens; AdminLanding ties the slice together.
isAdmin gating on the kebab still pending Phase 11 AuthController.
Until then the admin entries are reachable from any account, fine
on a single-user dev install but gates before any release tag.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the AdminQuarantine-route ComingSoon stub with the real
admin-side queue. Mirrors `flutter_client/lib/admin/admin_quarantine_screen.dart`
+ `AdminQuarantineController`.
New:
- models/wire/AdminQuarantineWire.kt — AdminQuarantineReportWire +
AdminQuarantineItemWire (per-user report and the aggregated row
that collapses reports into per-reason counts).
- models/AdminQuarantineItem.kt — domain refs.
`topReasonSummary` returns the most-cited reason with a "(+N more)"
suffix when other distinct reasons exist.
- api/endpoints/AdminQuarantineApi.kt — Retrofit list + the three
resolution endpoints (resolve / delete-file / delete-via-lidarr).
- admin/data/AdminQuarantineRepository.kt — list + three actions
with internal mappers; same point-and-shoot pattern as
AdminRequestsRepository (no offline queue).
- admin/ui/AdminQuarantineViewModel.kt — VM + UiState in sibling
file. `act()` collapses the three resolution paths into one
optimistic-remove-then-refetch-on-failure helper.
- admin/ui/AdminQuarantineScreen.kt — Scaffold + TopAppBar with
back button + MainAppBarActions. Each row shows track title +
"artist · album" subtitle + report-count pill + top-reason pill +
three action buttons (Resolve / Delete file / Delete + Lidarr).
Modified:
- nav/MinstrelNavGraph.kt — AdminQuarantine route now renders
`AdminQuarantineScreen(navController = navController)` inside
ShellScaffold.
AdminUsers + AdminLanding + Invites still ComingSoon — D3 lands them
together.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the AdminRequests-route ComingSoon stub with the real
admin-side review queue. Mirrors `flutter_client/lib/admin/admin_requests_screen.dart`
+ `AdminRequestsController` from `admin_providers.dart`.
New:
- api/endpoints/AdminRequestsApi.kt — Retrofit GET
/api/admin/requests + POST {id}/approve + POST {id}/reject.
Reuses RequestWire (server returns the same requestView shape as
/api/requests; only the listing scope differs).
- admin/data/AdminRequestsRepository.kt — list + approve + reject
+ internal wire→domain mapper. No MutationQueue fallback —
operator confirmation is point-and-shoot; failures roll back via
refetch rather than queuing for later replay.
- admin/ui/AdminRequestsViewModel.kt — VM + UiState (in its own
file to preempt TooManyFunctions). `decide()` optimistically
drops the row from local state and refetches on failure so the
UI matches the server's view.
- admin/ui/AdminRequestsScreen.kt — Scaffold + TopAppBar with back
button + MainAppBarActions; LazyColumn of rows showing displayName
+ kind/status pills + Approve/Reject button pair.
Modified:
- nav/MinstrelNavGraph.kt — AdminRequests route now renders
`AdminRequestsScreen(navController = navController)` inside
ShellScaffold.
AdminQuarantine + AdminUsers + AdminLanding still ComingSoon — they
follow in D2/D3. No isAdmin gating on the kebab yet either; until
the AuthController lands (Phase 11), the admin entries are reachable
from any account, which is fine on a single-user dev install but
gets gated before any release tag.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- models/Quarantine.kt → QuarantineRef.kt
- models/wire/QuarantineWire.kt → QuarantineMineWire.kt
Same fix as the earlier LikesWire → LikedIdsWire rename — detekt's
MatchingDeclarationName wants files with a single top-level
declaration to share its name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the Library Hidden-tab ComingSoonTab placeholder with the
real screen. Mirrors `flutter_client/lib/library/library_screen.dart`
`_HiddenTab` / `_QuarantineTile`.
New:
- models/wire/QuarantineWire.kt — @Serializable QuarantineMineWire
matching `/api/quarantine/mine`.
- models/Quarantine.kt — QuarantineRef domain; `reasonLabel` maps
the raw reason key ("bad_rip" / "wrong_file" / "wrong_tags" /
"duplicate" / other) to its display string.
- api/endpoints/QuarantineApi.kt — Retrofit listMine + flag + unflag
plus a FlagRequest @Serializable body for POST. The unflag
endpoint is idempotent server-side, which is what makes the
queued-replay path safe.
- quarantine/data/QuarantineRepository.kt — listMine + offline-first
unflag that returns UnflagOutcome (ACCEPTED vs. QUEUED).
`feedback_offline_first_for_server_writes` rationale identical
to LikesRepository.toggleLike.
- quarantine/ui/HiddenTabViewModel.kt — VM + UiState in its own
file (preempts TooManyFunctions). Optimistic-remove on unflag
with no rollback; the queue replays on failure.
- quarantine/ui/HiddenTab.kt — composable. List of rows showing
track title + "artist · album" subtitle + reason pill + Unhide
icon button (Lucide.ArchiveRestore).
Modified:
- cache/mutations/MutationQueue.kt — adds MutationKind.QUARANTINE_UNFLAG
+ QuarantineUnflagPayload + enqueueQuarantineUnflag helper.
- library/ui/LibraryScreen.kt — TAB_HIDDEN dispatch swaps from
ComingSoonTab to `HiddenTab()`. Drops the now-unreferenced
ComingSoonTab helper.
Admin slices (admin requests / quarantine / users) are still Commit D.
Flag-from-track-row UI lands once Album/Artist/Playlist detail screens
expose per-track action menus.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the Requests-route ComingSoon stub with the real screen.
Mirrors `flutter_client/lib/requests/requests_screen.dart`.
New:
- models/wire/RequestWire.kt — @Serializable matching
`internal/api/requests.go requestView`. Used by both
/api/requests and /api/admin/requests (admin reuse comes in
Commit D).
- models/Request.kt — RequestRef domain + RequestStatus enum
(PENDING / APPROVED / REJECTED / COMPLETED / FAILED / UNKNOWN).
`displayName` picks the kind-appropriate field (albumTitle for
album-kind etc).
- api/endpoints/RequestsApi.kt — Retrofit: GET /api/requests + DELETE
/api/requests/{id}. The cancel response returns the cancelled
row (not 204), so the wire return type is RequestWire.
- requests/data/RequestsRepository.kt — listMine + cancel with
internal wire→domain mapper. No Room cache — same rationale as
HistoryRepository.
- requests/ui/RequestsViewModel.kt — VM + UiState in a sibling file
(preempts the TooManyFunctions cap that Discover hit).
`cancel(id)` is optimistic: drops the row from local state
immediately, refetches on success (or rolls back via refetch on
failure).
- requests/ui/RequestsScreen.kt — composable: title bar with back
button + MainAppBarActions, LazyColumn of RequestRow tiles
(display name + status/kind pills + Cancel button visible only
on PENDING). Rejected requests surface the server-provided notes
line.
Modified:
- nav/MinstrelNavGraph.kt — Requests route now renders
`RequestsScreen(navController = navController)` inside ShellScaffold.
Hidden tab (quarantine) + admin slices come in Commits C and D.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DiscoverTiles.kt held only one non-composable top-level decl
(`enum class AvatarShape`), so detekt wanted the file renamed. The
enum had two variants discriminating circle vs. rounded; a Boolean
`circular` arg is the same information with no extra cost — collapses
the `when` into a one-line `if`. Two call sites updated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DiscoverScreen.kt still tripped TooManyFunctions (13/11) after the VM
split because the file kept all the per-row composables + helpers.
Moved SuggestionTile + ResultTile + Avatar + AvatarShape into a
sibling DiscoverTiles.kt and dropped the now-unused imports
(background, CircleShape, RoundedCornerShape, AssistChip, Disc3,
User, AsyncImage, size, clip, ImageVector, TextOverflow).
DiscoverScreen.kt now hosts 10 functions: the screen + 6 layout-only
helpers (SearchBar, KindChips, SuggestionsPane, SuggestionsList,
SuggestionsHeader, ResultsList) + LoadingCentered + CenteredMessage
+ snackbarFor.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DiscoverScreen.kt hit detekt's TooManyFunctions limit (11) at 13.
Moved DiscoverState / SuggestionState / ResultsState / DiscoverViewModel
into DiscoverViewModel.kt — same package, same imports, no behavior
change. Screen file now hosts only composables + the snackbarFor helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the Discover surface — Lidarr search bar over an out-of-library
artist suggestion feed, with offline-first request-creation through
the MutationQueue. Mirrors `flutter_client/lib/discover/discover_screen.dart`.
New:
- models/wire/DiscoverWire.kt — LidarrSearchResultWire,
ArtistSuggestionWire (with SeedContribution children), and the
CreateRequestBody POST shape.
- models/Discover.kt — domain refs + LidarrRequestKind enum.
ArtistSuggestionRef.attributionText preserves the Oxford-comma,
"Because you liked X / played Y" phrasing from Flutter.
- api/endpoints/DiscoverApi.kt — Retrofit: GET /api/discover/suggestions,
GET /api/lidarr/search (q + kind), POST /api/requests.
- discover/data/DiscoverRepository.kt — read-through search +
suggestion + offline-first createRequest. Returns
RequestOutcome.ACCEPTED on 2xx, RequestOutcome.QUEUED when the
call got buffered into the MutationQueue. Same swallowed-exception
rationale as LikesRepository.toggleLike.
- discover/ui/DiscoverScreen.kt — VM + state + composable. Filter
chips for Artists / Albums kind, search field with ImeAction.Search
submit, results list vs. suggestion feed swap based on whether
the query box is empty. Snackbar wording switches between
"Requested: X" and "Request queued: X" based on outcome.
Locally-just-requested MBIDs are tracked so the "Request" affordance
swaps to a "Requested" pill instantly without waiting for a server
refetch.
Modified:
- cache/mutations/MutationQueue.kt — adds MutationKind.REQUEST_CREATE
+ RequestCreatePayload + enqueueRequestCreate helper.
- nav/MinstrelNavGraph.kt — Discover route swaps from ComingSoon to
`DiscoverScreen(navController = navController)`.
Requests screen (your-own requests list with status/cancel) and the
admin/quarantine slices land in follow-up commits within this phase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Folded the early-return ladder in `relativeTime` into a single `when`
returning the result. Same four cutoff windows — `<1h` / `<24h` /
`<7d` / older — just bound to a single expression so detekt's
ReturnCount (limit 2) is satisfied. The opening "unparseable → return
raw" still uses an early return; that's only 2 total now.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the Library History-tab ComingSoon placeholder with a real
listening-history view. Tapping a row plays that single track via
PlayerController, matching Flutter's `_HistoryTab` behavior.
New:
- models/wire/HistoryWire.kt — @Serializable HistoryEventWire +
HistoryPageWire (`{events, has_more}`, the non-`Page<T>` envelope
/api/me/history actually returns).
- api/endpoints/HistoryApi.kt — Retrofit `GET /api/me/history` with
limit/offset query params (50/0 default).
- history/data/HistoryRepository.kt — fetch-only (no Room cache for
v1; the offline snapshot mirror lands with Phase 13). Maps the
wire shape into a UI-friendly HistoryEntry that carries the
converted TrackRef so playback wiring stays consistent with the
other tabs.
- history/ui/HistoryTab.kt — VM + UiState + composable. List of
HistoryRow tiles (title + artist + relative-time stamp);
tap-to-play single track via PlayerController.setQueue. The
`relativeTime` formatter mirrors Flutter's `library_screen.dart`
`_relativeTime` four-window strategy:
< 1h → "Nm ago"
< 24h → "Nh ago"
< 7d → "Tue 14:32"
≥ 7d → "May 1" (or "May 1, 2025" cross-year)
Built on `java.time.OffsetDateTime` — fine on minSdk 26 without
core-library desugaring.
Modified:
- library/ui/LibraryScreen.kt — TAB_HISTORY dispatch swaps from
ComingSoonTab to `HistoryTab()`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- LikesRepository.kt: the catch around best-effort like REST is
intentional swallow (the queue replays later). Added
`@Suppress("SwallowedException")` alongside the existing
`TooGenericExceptionCaught`, plus a comment explaining the choice
so the next reader doesn't "fix" it.
- models/wire/LikesWire.kt → LikedIdsWire.kt: file held a single
top-level declaration (LikedIdsWire); detekt's
MatchingDeclarationName rule wants the filename to match.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the Library Liked-tab ComingSoon placeholder with a real
hydrated view of liked artists / albums / tracks, plus the
offline-first toggle-like write path.
New:
- cache/mutations/MutationQueue.kt — minimal write-side of the
offline mutation queue (Phase 8 v1 only enqueues; the
connectivity-aware drain lands with Phase 12.2 SyncController).
Defines MutationKind.LIKE_TOGGLE + LikeTogglePayload + an
enqueueLikeToggle helper.
- api/endpoints/LikesApi.kt — Retrofit (POST/DELETE
`api/likes/{kind}/{id}` + GET `/api/likes/ids`). Plural-segment
mapping ("artist" → "artists") lives in LikesRepository.
- models/wire/LikesWire.kt — @Serializable LikedIdsWire matching
`internal/api/likes.go likedIDsResponse`.
- likes/data/LikesRepository.kt — observe (hydrated artists /
albums / tracks via the existing CachedAlbumDao /
CachedArtistDao / CachedTrackDao) + observeIsLiked +
toggleLike + refreshIds. Local userId is hardcoded as "local"
behind LOCAL_USER_ID; TODO marker for the Phase-11 swap to
AuthStore.userId. Write path is optimistic Room mutation →
best-effort REST → enqueue-on-failure, per
`feedback_offline_first_for_server_writes`.
- likes/ui/LikedTab.kt — VM + UiState + composable. Three sections
(Artists horizontal row, Albums horizontal row, Tracks list) +
"No likes yet" empty state. Tile taps navigate to detail screens;
track-row taps are disabled until Phase 9 wires history play-from
-here (placeholder so the row reads correctly without an
unfinished playback affordance).
Modified:
- cache/db/DatabaseModule.kt — @Provides for CachedLikeDao +
CachedMutationDao (DAOs existed but had no consumer until now).
- library/ui/LibraryScreen.kt — TAB_LIKED dispatch swaps from
ComingSoonTab to `LikedTab(navController)`.
Like buttons on detail screens come with the AlbumDetail / ArtistDetail
real-screen build, which is a separate later commit (they're still
ComingSoon stubs in MinstrelNavGraph).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PlaylistDetailScreen takes navController for its TopAppBar back-button,
but the inShellDetail NavGraphBuilder extension was still scoped to
just expandPlayer. Added navController as the first parameter and
updated the call site.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refactor of the combine chain dropped the closing `}` for the
HomeViewModel class, so the screen composable below ended up
nested inside the ViewModel and the file's brace count was off
by one. Cascaded into "Unresolved reference HomeScreen" downstream.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Second slice of Playlists feature parity. PlaylistDetail route now
renders the real screen instead of the ComingSoon stub; Home's
Playlists row now shows actual PlaylistCards instead of the
placeholder header.
New:
- playlists/ui/PlaylistDetailScreen.kt — VM + UiState + Screen.
Header (cover + name + description + track count + Play / Shuffle
buttons) over a track list (numbered TrackRow with duration).
Unavailable tracks (trackId == null because the upstream library
row was removed) render at 0.4 alpha and don't accept taps, per
Flutter's `isAvailable` convention. Tap on a track plays the
playlist starting there via `PlayerController.setQueue(refs,
initialIndex, source = "playlist:$id")`. Shuffle reuses the same
path on a `shuffled()` copy — cheap for the page-sized list.
Modified:
- home/ui/HomeScreen.kt — HomeViewModel now also takes
PlaylistsRepository; calls refreshList() alongside refreshIndex()
on init. HomeSections gets a `playlists: List<PlaylistRef>` field
(factored into isAllEmpty). HomeSuccessContent shows a real
PlaylistsRow when non-empty (replacing the "Lands in Phase 7"
EmptySectionHeader). Tile tap navigates to PlaylistDetail.
Combine arity capped at 5 by kotlinx.coroutines, so the screen
splits into observeHomeSections() (the five HomeRepository flows)
chained against the PlaylistsRepository flow — avoids untyped
vararg-combine gymnastics across heterogeneous list types.
- nav/MinstrelNavGraph.kt — PlaylistDetail route swaps from
ComingSoon to `PlaylistDetailScreen(navController = navController)`.
The route id flows in via SavedStateHandle.toRoute() inside the
ViewModel rather than backStackEntry.toRoute(), so the composable
block is back to a one-liner.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Foundation slice of Playlists feature parity with Flutter v2026.05.21.0.
Replaces the ComingSoon stub on the Playlists route with a real
two-section list screen (System playlists / Your playlists), cache-first
against `cached_playlists`.
New:
- models/Playlist.kt — PlaylistRef + PlaylistTrackRef domain models.
Mirrors `flutter_client/lib/models/playlist.dart` (id + name +
isSystem + cover + ownerUsername etc.; PlaylistTrack carries the
full per-row display fields since cached_playlist_tracks only holds
ordered (playlistId, trackId, position) triples).
- models/wire/PlaylistWire.kt — @Serializable wire types
(PlaylistWire / PlaylistsListWire / PlaylistTrackWire /
PlaylistDetailWire), matching `internal/api/playlists.go`.
- api/endpoints/PlaylistsApi.kt — Retrofit interface (list + get).
Read-only for now; create/append/refreshSystem land with the
mutation-queue phase.
- playlists/data/PlaylistsRepository.kt — observe (all / user /
system) cache-first reads + refreshList / refreshDetail that
upsert Room and return a hydrated PlaylistDetailRef. Internal
entity↔wire↔domain mappers kept private.
- playlists/widgets/PlaylistCard.kt — 176dp tile sized to match
AlbumCard for visual consistency in the upcoming Home carousel.
Subtitle shows the system-variant label ("For You" / "Discover" /
"Songs like…" / etc.) or "N tracks" for user playlists.
- playlists/ui/PlaylistsListScreen.kt — Scaffold + TopAppBar +
MainAppBarActions; LazyVerticalGrid with adaptive 176dp cells.
Renders both `System playlists` and `Your playlists` sections via
full-width section headers (`GridItemSpan(maxLineSpan)`).
Modified:
- cache/db/DatabaseModule.kt — adds @Provides for CachedPlaylistDao
+ CachedPlaylistTrackDao (DAOs existed on AppDatabase since slice 1
but had no consumer until now).
- nav/MinstrelNavGraph.kt — swaps the ComingSoon stub for
`PlaylistsListScreen(navController = navController)`.
PlaylistDetail route still ComingSoon; lands in the next commit along
with Home-page Playlists row integration.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
detekt flagged the `3` and `4` branch labels in the `when (selectedTab)`
block. Promoted all five indices to TAB_ARTISTS … TAB_HIDDEN constants
— same shape detekt would have suggested.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the transitional two-LazyRow shape with the proper 5-tab
Library matching `flutter_client/lib/library/library_screen.dart`:
[Artists] [Albums] [History] [Liked] [Hidden]
- Artists / Albums — real adaptive 3+-up LazyVerticalGrid backed by
the existing LibraryViewModel (cache-first reads of cached_artists
/ cached_albums). GridCells.Adaptive sizes from card width
(ArtistCard 144dp, AlbumCard 176dp), so phones get 3 cols and
tablets pack more.
- History / Liked / Hidden — EmptyState placeholders with phase
pointers (Phase 9 / 8 / 10 respectively). The data-layer plumbing
for each lands with its umbrella phase, not as a Home/Library
polish patch.
TabBar is `PrimaryScrollableTabRow` (Material3) so on narrower screens
the row scrolls horizontally without truncating labels — same
behavior as Flutter's `TabBar(isScrollable: true)`.
The Library tab is now reachable both as the in-shell route AND
through MainAppBarActions; the icon row suppresses the Library icon
when this screen is current (per `currentRouteName = Library::class.qualifiedName`).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HomeRepository's CachedHomeIndexDao constructor injection failed with
"cannot be provided without an @Provides-annotated method" — the DAO
existed on AppDatabase but the per-DAO bridge in DatabaseModule was
never added (no consumer until HomeRepository landed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the ComingSoon stub with the actual Home matching the Flutter
client's `home_screen.dart` shape — vertical Column of named horizontal
sections, each row a labeled `HorizontalScrollRow`:
Playlists (placeholder header — Phase 7)
Recently added → AlbumCards
Rediscover → AlbumCards (and/or ArtistCards)
Most played → CompactTrackTile
Last played → ArtistCards
Wire path: `GET /api/home/index` → `HomeRepository.refreshIndex()`
upserts five sections into `cached_home_index`. Per-section Flows
observe that table and hydrate each ID against the existing
album/artist/track DAOs — rows that haven't been pulled into Room yet
are silently dropped from emission (the per-tile hydration queue from
Phase 7+ will fill those gaps).
New files:
- models/wire/HomeIndexWire.kt — @Serializable wire shape
- api/endpoints/HomeApi.kt — Retrofit `GET /api/home/index`
- home/data/HomeRepository.kt — observe/refresh + section constants
- home/ui/HomeScreen.kt — composable + HomeViewModel + HomeUiState
+ inline CompactTrackTile (proper CompactTrackCard lands in Phase 7
alongside player play-by-ID and per-track cover hydration)
- shared/widgets/HorizontalScrollRow.kt — labeled LazyRow wrapper
that takes a LazyListScope block (keeps row items lazy)
Modified:
- nav/MinstrelNavGraph.kt — startDestination = Home (was Library;
matches Flutter's `redirect '/' → '/home'`); Home composable now
renders the real `HomeScreen(navController)` inside `ShellScaffold`
CompactTrackTile uses a Lucide.Music placeholder for the cover because
TrackRef doesn't carry coverUrl — matching the Flutter tile-provider
hydration is a Phase-7 follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Upstream Lucide renamed `more-vertical` → `ellipsis-vertical`; the
icons-lucide-cmp 2.2.1 bundle only exposes the new name, so the
import was unresolved.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
detekt LongMethod (97/60 lines). Body had no actual logic — just 13
sequential composable<T>() route declarations. Split by route category
(matches the existing comment headers):
- inShellTopLevel(navController, expandPlayer) — 8 in-shell tabs
- inShellDetail(expandPlayer) — 6 push-on-top detail screens
- outsideShell() — NowPlaying (with slide-up transitions), Queue,
ServerUrl, Login
`MinstrelNavGraph` itself is now 15 lines (NavHost shell that delegates
to the three groups), and each helper sits well under the 60-line cap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Aligns with Flutter — there is no bottom nav, drawer, or rail. Every
in-shell screen carries `MainAppBarActions` in its AppBar:
[Home] [Library] [Search] [ ⋮ Playlists / Discover / Settings / Admin ]
The icon for the current screen is suppressed so the action set looks
contextual.
- shared/widgets/MainAppBarActions.kt — NEW. The icon row + kebab.
Takes navController + currentRouteName (FQN) so each screen tells
it which icon to hide. Admin kebab entry gated on `isAdmin` for
later; defaults false.
- shared/widgets/ShellScaffold.kt — NEW. Wraps any in-shell screen
with the MiniPlayer pinned at the bottom (auto-hides on no-track,
matches Flutter `_ShellWithPlayerBar`). Banners slot reserved for
later (VersionTooOld / UpdateBanner).
- nav/Routes.kt — added Discover, Playlists, Requests, Admin,
AdminRequests, AdminQuarantine, AdminUsers, ServerUrl. Grouped
by shell-vs-full-screen comments.
- nav/MinstrelNavGraph.kt — every in-shell route wrapped in
ShellScaffold. NowPlaying becomes a full-screen route with
slideInVertically/slideOutVertically transitions (mirrors
Flutter's CustomTransitionPage modal). Queue / ServerUrl / Login
are also outside the shell.
- MainActivity.kt — drops Scaffold + NavigationBar + the BottomBarTab
list. Just hosts the NavHost now. The MiniPlayer moves into
ShellScaffold per the Flutter pattern.
- library/ui/LibraryScreen.kt — wraps itself in Scaffold + TopAppBar
+ MainAppBarActions (currentRouteName = Library FQN). Accepts
navController; album/artist taps navigate via the controller
instead of via callbacks. Body content still transitional — the
proper 5-tab restructure lands in sub-task 4.
Routes-without-real-screens (Home, Search, Discover, Playlists,
Settings, Admin, Requests, AdminRequests/Quarantine/Users, Queue,
ServerUrl, Login) all render ComingSoon stubs via EmptyState so the
nav graph is fully reachable end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sub-task 1 of the design-drift correction. Adds light theme support
and adopts the Flutter pattern of consuming tokens directly via a
theme-extension equivalent (CompositionLocal data class) rather than
fitting everything into Material's ColorScheme roles.
Files:
- theme/FabledSwordTokens.kt — split the monolith into three
objects: FabledSwordDarkTokens (#14171A obsidian, etc.),
FabledSwordLightTokens (#F8F5EE obsidian, #14171A parchment — note
the semantic inversion, names are roles not literal colors),
FabledSwordFlatTokens (moss/bronze/oxblood/warning/error/info/
accent/onAction + radii). The old FabledSwordTokens object is
kept as a @Deprecated alias re-exporting dark+flat — existing call
sites compile with a warning until migrated.
- theme/FabledSwordTheme.kt — NEW. Data class holding the full
14-color set + radii, with Dark/Light companion factories.
LocalFabledSwordTheme CompositionLocal exposes the active variant.
- theme/MinstrelTheme.kt — both darkColorScheme and lightColorScheme
defined; MinstrelTheme composable accepts darkOverride and falls
back to isSystemInDarkTheme(). Provides LocalFabledSwordTheme +
keeps LocalActionColors for back-compat.
- widget files (AlbumCard, MiniPlayer, NowPlayingScreen,
ActionColors) migrated to import FabledSwordFlatTokens directly
for radii / action colors (mode-independent).
Sub-tasks 2-4 (shell, Home, Library tabs) will follow, each its own
commit. Detail screens stay as stubs until their feature phases.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adding `<ResumePayload>` to encodeToString made it bind to the wrong
overload — the compiler picked `encodeToString(SerializationStrategy<T>,
T)` and tried to treat `payload` as the serializer. Switched to the
explicit form:
json.encodeToString(ResumePayload.serializer(), payload)
Always unambiguous. (Decode is fine — `decodeFromString<T>(String)`
isn't overloaded the same way.)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Kotlin 2.3 + kotlinx.serialization 1.7 — the reified overload of
`Json.encodeToString(value: T)` failed to infer T from the argument's
type at the call site (the compiler resolved to the
SerializationStrategy + value overload and complained both about
the type mismatch and the missing 'value' arg). Specifying
`<ResumePayload>` explicitly resolves to the correct overload.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
restore() had 3 explicit returns (row null + decode-failure + empty
tracks) — over detekt's ReturnCount limit of 2. Folded the decode
+ empty-check into a single runCatching chain:
runCatching { decode }
.onFailure { dao.clear() side-effect }
.getOrNull()
?.takeIf { tracks.isNotEmpty() }
?: return
Two returns now (row missing + the chain result null). Cleaner read
too — the side effect of dropping a corrupt row is right next to the
decode it guards.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 6 closes. A torn-down player session now resumes the last queue
on next app launch — the equivalent of the Flutter ResumeController's
job, but plumbed via PlayerController's StateFlow rather than the
audio_service idle-stop dance.
Files:
- models/TrackRef.kt: add @Serializable so List<TrackRef> can be
JSON-encoded by the persistence path (mild leak of persistence
concern into the domain type; alternative duplicate-DTO approach
not worth the boilerplate yet).
- player/ResumePayload.kt: @Serializable persisted shape
(schema version + tracks + queueIndex + positionMs + source).
`schema` field lets future schema drift drop unreadable rows
gracefully rather than crash.
- player/ResumeController.kt: collects PlayerController.uiState;
persists when (currentTrack id, queueIndex, queue.size) changes —
captures real session transitions without churning on the 1Hz
position tick. restore() decodes the row and calls
PlayerController.setQueue. Catches SerializationException +
drops the row on schema drift.
- cache/db/DatabaseModule.kt: @Provides CachedResumeStateDao bridge.
- MinstrelApplication: @Inject ResumeController + ApplicationScope
CoroutineScope; onCreate launches resumeController.restore().
Injecting forces Hilt to construct the singleton so its
observe-and-persist init block runs.
No circular DI — ResumeController depends on PlayerController, not
the other way around.
This closes Phase 6 of the M8 native rewrite. The player layer is
feature-complete enough to demo on a device once playback wiring
arrives (Phase 11 settings → server URL, Phase 12 sync controller →
library data, and a "Play this album" affordance — none of which
exist yet).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NowPlayingScreen was 74 lines vs detekt's 60 threshold. Split into
three logical pieces: CoverPlaceholder, TrackHeader, and the
top-level Column orchestrator (which now stays under threshold and
reads more clearly).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
First visible player surfaces.
- player/ui/PlayerViewModel.kt — thin HiltViewModel wrapping the
singleton PlayerController. Both MiniPlayer and NowPlayingScreen
hiltViewModel() one of these; the underlying state is shared by
construction (controller is process-singleton).
- player/ui/MiniPlayer.kt — collapsed bar above the bottom nav.
Returns nothing when no track is loaded (zero footprint on fresh
install). Tap body → navigate(NowPlaying). Cover-art slot is a
Lucide placeholder for now; covers wire up when AlbumRef joins
land in a later 5.x slice.
- player/ui/NowPlayingScreen.kt — full-screen player. Square cover
(placeholder), title + artist + album, scrubber (Slider with
seek-on-release), transport row (prev / play-pause / next).
EmptyState fallback when no track. Play/pause button uses
LocalActionColors.primary (Moss) per design-system rule.
- MainActivity: Scaffold bottomBar slot now wraps MiniPlayer +
MinstrelBottomBar in a Column so the mini sits above the nav.
- MinstrelNavGraph: NowPlaying composable now renders the real
screen instead of the "Coming soon" stub.
scrubber-position-while-playing is event-driven for now (Media3
batches via Player.Listener.onEvents). A periodic 1Hz refresh for
smooth scrubber animation can come later if it's wanted; functional
seeking + position display work without it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Two TooGenericExceptionCaught: connectAndObserve + connectController
both catch Exception over Media3 IPC boundaries where specific-
exception handling buys nothing (ListenableFuture.get() throws
ExecutionException / InterruptedException / CancellationException —
all forwarded uniformly). Widened to Throwable and @Suppressed with
a one-line rationale each.
- MaxLineLength: refactored TrackRef.toMediaItem's nested
`.apply { source?.let { setExtras(Bundle()...) } }` chain into a
pair of expression-bodied helpers (metadata builder + sourceExtras).
Reads cleaner; under 120 chars.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hilt-singleton facade over Media3 MediaController (the IPC client to
MinstrelPlayerService's MediaSession). One process-wide controller +
one StateFlow projection means ViewModels don't each attach their
own Player.Listener.
PlayerUiState: data class with currentTrack / queue / queueIndex /
isPlaying / isBuffering / positionMs / durationMs / bufferedPositionMs
/ playbackError. The mini-player + NowPlayingScreen (Phase 6.4) read
this; the rest of the app sees one consistent player snapshot.
PlayerController:
- init: async connectAndObserve via suspendCancellableCoroutine
bridging Media3's ListenableFuture<MediaController>.buildAsync().
Skips the kotlinx-coroutines-guava dep (Runnable::run is a direct
executor; the listener just unparks our continuation).
- Transport methods (play/pause/seekTo/skipToNext/skipToPrevious)
are no-ops until the controller connects; safe to call early.
- setQueue(tracks, initialIndex, source) — TrackRef -> MediaItem
with mediaId + uri + metadata; source tag goes in extras for the
server-side rotation reporter (#415 parity).
- Player.Listener.onEvents drives uiState snapshot — Media3 batches
related events so we don't churn the StateFlow per-event.
- queueRefs kept as our own list so the UiState projection has
domain TrackRefs (Media3 has MediaItems internally).
No tests yet — PlayerController's main behavior is IPC-mediated and
benefits from an instrumented test (Robolectric or device). JVM
unit tests for it would mostly mock the MediaController and verify
trivial method-forwarding. Deferred.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The actual replacement for everything audio_service plugin wrapped.
Media3 owns the foreground-service lifecycle, MediaSession token,
notification card, lock-screen surface, Bluetooth/AVRCP routing,
Pixel Watch tile, and Android Auto adapter natively — no plugin
layer between us and the platform.
Service shape (~25 LOC):
- @AndroidEntryPoint MediaSessionService
- @Inject PlayerFactory builds ExoPlayer in onCreate
- onGetSession returns the live MediaSession to any binding
controller (system UI, Wear OS companion, MediaController3 clients)
- onTaskRemoved keeps playing while audio is active (standard
media-app behavior); otherwise stopSelf so notification clears
- onDestroy releases session + player
Compare with flutter_client/lib/player/audio_handler.dart's 1000+ LOC
across MinstrelAudioHandler + the soft-teardown / stall-watchdog /
recovery machinery. Media3 owns most of that natively; we'll get to
the small portions we still need (queue management, position
reporting facade) in 6.3.
Manifest registration: foregroundServiceType="mediaPlayback" +
MediaSessionService intent-filter. MediaButtonReceiver is registered
by the Media3 library; no manual receiver class needed (Flutter's
manifest had to declare audio_service's receiver explicitly).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
detekt's PackageNaming rule rejects underscores in package names
(Kotlin/Java convention is lowercase, no separator). Renamed
com.fabledsword.minstrel.cache.audio_cache -> .audiocache.
Pattern for future multi-word subpackages: smush rather than _
separator (e.g. mutationqueue, synccontroller, when those land).
The on-disk audio_cache/ dir path inside the app cache (PlayerFactory.kt:41)
is unaffected — that's a filename string, not a package.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
First Media3 wiring. PlayerFactory builds the process-singleton
ExoPlayer with our shared OkHttp + SimpleCache chain; the
MinstrelPlayerService (Phase 6.2) calls build() in onCreate.
Chain shape:
ExoPlayer
.setMediaSourceFactory(DefaultMediaSourceFactory + CacheDataSource)
.setAudioAttributes(USAGE_MEDIA + CONTENT_TYPE_MUSIC, focus=true)
.setHandleAudioBecomingNoisy(true)
CacheDataSource
.setCache(SimpleCache(audio_cache dir, LRU evictor, Room standalone DB))
.setUpstreamDataSourceFactory(OkHttpDataSource over shared OkHttp)
.setCacheWriteDataSinkFactory(CacheDataSink full-fragment)
Built-in audio focus + becoming-noisy handling — Media3 owns these so
no audio_session-equivalent code path is needed (the Flutter app had
~40 LOC for the same; here it's three lines of config).
simpleCache exposed as a PlayerFactory val so the AudioCacheEviction
Worker (Phase 12.3) can call removeSpan() during 2-bucket eviction.
CacheConfig (defaults 200MiB liked + 150MiB rolling) — Phase 11
Settings will let users override.
Bumped Media3 1.4.1 -> 1.10.1 (current stable, AGP 9 + Kotlin 2.3
friendly, MediaSessionService now extends LifecycleService which
makes 6.2's lifecycle-aware patterns cleaner). Breaking changes
between 1.4 and 1.10 don't affect our usage (DRM, FrameExtractor,
ChannelMixingMatrix — we use none).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>