fix(artist): split conjunctions correctly, resolve missing IDs, make artists clickable#3813
fix(artist): split conjunctions correctly, resolve missing IDs, make artists clickable#3813kairosci wants to merge 13 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughLocalize artist-list joining (use localized “and”), add ClickableArtistText, migrate many composables to a LocalNavController, add artist-page caching with Room v38 and AutoMigration, and tighten innertube artist parsing and mapping. ChangesArtist UI, navigation, cache, DB, and parser
Estimated code review effort: Possibly related PRs
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
|
|
This applies to Italian artists, but the same principle applies to artists of other nationalities as well |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
innertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt (1)
34-37:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMake conjunction splitting case-insensitive
conjunctionPatternis built withoutRegexOption.IGNORE_CASE, so in-text splitting remains case-sensitive while the standalone conjunction check is case-insensitive—mixed/upper-case conjunctions can bypass splitting.Proposed fix
- val conjunctionPattern = Regex( - if (words.isNotEmpty()) " (${words.joinToString("|") { Regex.escape(it) }}) | & " - else " & " - ) + val conjunctionPattern = Regex( + if (words.isNotEmpty()) " (${words.joinToString("|") { Regex.escape(it) }}) | & " + else " & ", + options = setOf(RegexOption.IGNORE_CASE) + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@innertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt` around lines 34 - 37, conjunctionPattern in Runs.kt is constructed without case-insensitive matching so mixed/upper-case conjunctions aren't split; update the Regex creation for conjunctionPattern to use case-insensitive matching (e.g., pass RegexOption.IGNORE_CASE or embed (?i)) so the pattern built from words and the standalone " & " are matched regardless of case, keeping the same joinToString logic that escapes words.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/kotlin/com/metrolist/music/db/entities/SpeedDialItem.kt`:
- Line 80: Deserialization is still splitting artist strings using the
hard-coded ", " while serialization uses ARTIST_SEPARATOR (causing round-trip
failure); update the deserialization calls that currently use split(", ") to
split(ARTIST_SEPARATOR) (and preserve trimming if needed), i.e., change the code
that converts the subtitle back into artist names to use ARTIST_SEPARATOR
instead of the literal ", " in the SpeedDialItem deserialization logic so both
occurrences are fixed.
In `@app/src/main/kotlin/com/metrolist/music/ui/player/MiniPlayer.kt`:
- Around line 674-677: In MiniPlayer.kt update the logic that computes
displayArtists: stop filtering artists by it.id != null and instead only filter
by non-blank names (e.g., metadata.artists.filter { it.name.isNotBlank() }) so
the Text that joins names with ARTIST_SEPARATOR always shows valid names;
preserve any existing id checks where artist IDs are required for actions
(subscribe/navigation) rather than for rendering.
In `@app/src/main/kotlin/com/metrolist/music/utils/PlaylistExporter.kt`:
- Line 133: PlaylistExporter started using the ARTIST_SEPARATOR constant when
serializing artists but loadM3UOnline in BackupRestoreViewModel still splits
artist fields with a hardcoded ';', breaking round-trip imports; update
loadM3UOnline to use the same ARTIST_SEPARATOR constant (or split on
Regex.escape(ARTIST_SEPARATOR) if treating it as a regex) instead of split(';')
so both export (PlaylistExporter) and import (loadM3UOnline) use the identical
delimiter.
In `@app/src/main/kotlin/com/metrolist/music/utils/Utils.kt`:
- Line 12: Replace the hardcoded ARTIST_SEPARATOR constant with a locale-aware
retrieval and update callsites to use it: remove or stop using const val
ARTIST_SEPARATOR in Utils.kt and provide a way to get the separator from
resources (e.g., use context.getString(R.string.and) or
stringResource(R.string.and) in composables) so UI code that composes artists
(where ARTIST_SEPARATOR was used) builds the separator as "
${context.getString(R.string.and)} " rather than the literal " e "; update all
usages to call the new localized accessor or inline resource lookup (referencing
R.string.and and the former ARTIST_SEPARATOR symbol to find replacements).
---
Outside diff comments:
In `@innertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt`:
- Around line 34-37: conjunctionPattern in Runs.kt is constructed without
case-insensitive matching so mixed/upper-case conjunctions aren't split; update
the Regex creation for conjunctionPattern to use case-insensitive matching
(e.g., pass RegexOption.IGNORE_CASE or embed (?i)) so the pattern built from
words and the standalone " & " are matched regardless of case, keeping the same
joinToString logic that escapes words.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 39b94326-94e9-4d2d-a7cf-c9f6c8859fff
📒 Files selected for processing (20)
app/src/main/kotlin/com/metrolist/music/db/entities/SpeedDialItem.ktapp/src/main/kotlin/com/metrolist/music/listentogether/ListenTogetherManager.ktapp/src/main/kotlin/com/metrolist/music/playback/MediaLibrarySessionCallback.ktapp/src/main/kotlin/com/metrolist/music/playback/MusicService.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Items.ktapp/src/main/kotlin/com/metrolist/music/ui/component/SongDropdownSelect.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/AlbumMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/SongMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/YouTubeSongMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/player/MiniPlayer.ktapp/src/main/kotlin/com/metrolist/music/ui/player/Player.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HomeScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/pages/WrappedTop5SongsScreen.ktapp/src/main/kotlin/com/metrolist/music/utils/PlaylistExporter.ktapp/src/main/kotlin/com/metrolist/music/utils/Utils.ktapp/src/main/kotlin/com/metrolist/music/viewmodels/BackupRestoreViewModel.ktapp/src/main/res/values-it/metrolist_strings.xmlinnertube/src/main/kotlin/com/metrolist/innertube/models/Runs.ktinnertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistItemsPage.ktinnertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistPage.kt
b83719f to
08a5f17
Compare
When artists are separated by conjunctions in YouTube Music API responses, all artists now maintain their navigationEndpoint, not just the first one. This allows each artist to be individually clickable without showing commas. Fixes: PR MetrolistGroup#3813
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@innertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt`:
- Line 44: The current split handling adds Run(part.trim(),
run.navigationEndpoint) for every split part, causing all parts to share the
same navigationEndpoint; change the logic so only the first split part keeps
run.navigationEndpoint and all subsequent parts use null — i.e., when building
Runs (see Run constructor and the variable run used in the split loop that calls
result.add(...)), pass run.navigationEndpoint for the first part and null for
others (use an index or a boolean firstPart flag) so secondary artists don't
route to the first artist's page.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dbc3ec74-5be5-4d37-8d82-15a138952889
📒 Files selected for processing (4)
app/src/main/kotlin/com/metrolist/music/ui/component/SongDropdownSelect.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HomeScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/pages/WrappedTop5SongsScreen.ktinnertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt
🚧 Files skipped from review as they are similar to previous changes (1)
- app/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/pages/WrappedTop5SongsScreen.kt
9c9d932 to
9abbce6
Compare
|
Note regarding the first version: #3695 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/kotlin/com/metrolist/music/db/entities/ArtistPageCache.kt`:
- Around line 169-170: The cached mapping is turning absent thumbnails into a
non-null blank string; update the mapping in ArtistPageCache (where thumbnail is
assigned alongside author = author?.let {
com.metrolist.innertube.models.Artist(it.name, it.id) }) to preserve null
semantics by assigning null when there is no thumbnail instead of using ""
(apply the same change to the other thumbnail assignment sites noted: the
occurrences around the author mapping and the other listed spots). Locate the
mapping functions/constructors in ArtistPageCache.kt that set the thumbnail
property and replace any "" fallback with a nullable assignment (e.g., keep
thumbnail as thumbnail or thumbnail?.takeIf { it.isNotBlank() } ?: null) so
restored items retain null for absent thumbnails.
In `@app/src/main/kotlin/com/metrolist/music/ui/component/Items.kt`:
- Around line 521-523: The plain-text branches are using joinToString with
stringResource(R.string.and) which causes inconsistent formatting vs
ClickableArtistText; replace the inline joinToString usage with the same
artist-formatting helper used by ClickableArtistText (instead of building "
${stringResource(R.string.and)} " yourself) so that joinByBullet(...) (or the
shared artist formatting function used by ClickableArtistText) receives the
already-formatted artist string; update occurrences around joinByBullet,
ClickableArtistText, and song.orderedArtists at the listed locations (521-523,
620-623, 788-792, 868, 1143-1159, 1226-1227, 1307-1308) to call that shared
helper rather than joinToString with the raw localized conjunction.
In `@app/src/main/kotlin/com/metrolist/music/ui/screens/HomeScreen.kt`:
- Line 371: The subtitle currently builds artists with
song.artists.joinToString(" ${stringResource(R.string.and)} ") which produces "A
and B and C"; replace that joinToString call in HomeScreen (and the similar
occurrences around the card subtitles) with the shared artist-formatting helper
used elsewhere (the centralized function that formats artist lists for 3+
artists) so subtitles use the "A, B & C" style; locate the joinToString usage
(song.artists.joinToString(...)) and swap it to call the existing helper (the
same helper already used in other screens) so all UI cards use the consistent
artist formatter.
In `@app/src/main/kotlin/com/metrolist/music/viewmodels/ArtistViewModel.kt`:
- Around line 160-162: The cache is being populated with filteredSections which
makes cached pages reflect current hide-* settings; change the
serializeArtistPage call in ArtistViewModel (where serializeArtistPage(...) is
invoked) to pass the original unfiltered sections (e.g., sections or
resolvedPage.sections) instead of filteredSections so the cache stores the full
dataset; keep using filteredSections only for UI rendering but serialize the
unfiltered source for caching.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: da645add-1727-4020-b741-9dec3fb450a4
📒 Files selected for processing (36)
app/schemas/com.metrolist.music.db.InternalDatabase/38.jsonapp/src/main/kotlin/com/metrolist/music/db/MusicDatabase.ktapp/src/main/kotlin/com/metrolist/music/db/entities/ArtistEntity.ktapp/src/main/kotlin/com/metrolist/music/db/entities/ArtistPageCache.ktapp/src/main/kotlin/com/metrolist/music/listentogether/ListenTogetherManager.ktapp/src/main/kotlin/com/metrolist/music/playback/MediaLibrarySessionCallback.ktapp/src/main/kotlin/com/metrolist/music/playback/MusicService.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Items.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Library.ktapp/src/main/kotlin/com/metrolist/music/ui/component/SongDropdownSelect.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/AlbumMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/QueueMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/SongMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/YouTubeAlbumMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/player/MiniPlayer.ktapp/src/main/kotlin/com/metrolist/music/ui/player/Queue.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/AlbumScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HistoryScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HomeScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistSongsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryMixScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryPodcastsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibrarySongsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/AutoPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/CachePlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/LocalPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/TopPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/search/LocalSearchScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/pages/WrappedTop5SongsScreen.ktapp/src/main/kotlin/com/metrolist/music/utils/Utils.ktapp/src/main/kotlin/com/metrolist/music/viewmodels/ArtistViewModel.ktapp/src/main/res/values-it/metrolist_strings.xmlinnertube/src/main/kotlin/com/metrolist/innertube/models/Runs.ktinnertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistItemsPage.ktinnertube/src/main/kotlin/com/metrolist/innertube/pages/ArtistPage.kt
✅ Files skipped from review due to trivial changes (1)
- app/src/main/res/values-it/metrolist_strings.xml
🚧 Files skipped from review as they are similar to previous changes (3)
- innertube/src/main/kotlin/com/metrolist/innertube/models/Runs.kt
- app/src/main/kotlin/com/metrolist/music/ui/component/SongDropdownSelect.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/pages/WrappedTop5SongsScreen.kt
|
cc: @nyxiereal @adrielGGmotion I've tested it and it works, but if you have any feedback or suggestions on how to improve it further, I'm open to them. This way, artist management becomes more stable, more user-friendly, and more reliable. |
a3cffbb to
d849b66
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/kotlin/com/metrolist/music/ui/menu/YouTubeSongMenu.kt`:
- Around line 97-103: YouTubeSongMenu reads LocalNavController.current but may
be shown from an overlay host that lives outside the NavController composition
local; either preserve the composition-local when showing the overlay or pass a
concrete NavController into the menu. Fix by capturing the current
LocalNavController (val navController = LocalNavController.current) at the call
site and then when invoking LocalMenuState.show { ... } ensure you re-provide it
via CompositionLocalProvider(LocalNavController provides navController) around
the YouTubeSongMenu content (or change YouTubeSongMenu signature to accept a
NavController param and use that for navController.navigate calls), so
navController.navigate(...) always resolves to the intended controller.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 400dd82c-09d9-4a37-9926-7d479a5cc1da
📒 Files selected for processing (46)
app/src/main/kotlin/com/metrolist/music/MainActivity.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Dialog.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Items.ktapp/src/main/kotlin/com/metrolist/music/ui/component/Library.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/AlbumMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/PlayerMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/QueueMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/SongMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/YouTubeAlbumMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/menu/YouTubeSongMenu.ktapp/src/main/kotlin/com/metrolist/music/ui/player/Player.ktapp/src/main/kotlin/com/metrolist/music/ui/player/Queue.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/AccountScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/AlbumScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/BrowseScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/ChartsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/ExploreScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HistoryScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/HomeScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/NavigationBuilder.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/NewReleaseScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/StatsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/YouTubeBrowseScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistAlbumsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistItemsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistSongsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/equalizer/EqScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryAlbumsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryArtistsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryMixScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryPlaylistsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryPodcastsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/library/LibrarySongsScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/AutoPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/CachePlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/LocalPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/OnlinePlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/playlist/TopPlaylistScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/podcast/OnlinePodcastScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/search/LocalSearchScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/search/OnlineSearchResult.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/search/OnlineSearchScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/search/SearchScreen.ktapp/src/main/kotlin/com/metrolist/music/ui/screens/wrapped/WrappedScreen.kt
💤 Files with no reviewable changes (22)
- app/src/main/kotlin/com/metrolist/music/ui/screens/NewReleaseScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/ChartsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/StatsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/AccountScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryArtistsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibrarySongsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistAlbumsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistItemsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/BrowseScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryAlbumsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/ExploreScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryPlaylistsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistSongsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/AlbumScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/playlist/TopPlaylistScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/playlist/AutoPlaylistScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryMixScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/artist/ArtistScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/library/LibraryPodcastsScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/playlist/CachePlaylistScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/HistoryScreen.kt
- app/src/main/kotlin/com/metrolist/music/ui/screens/YouTubeBrowseScreen.kt
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
I've just realized that it might be a bit long, so maybe over the next few days I'll create a separate post for each point mentioned, to keep things cleaner. I'll leave it open for now as a reference and for portability. |
|
im just reviewing it rn 😭 |
0493ff0 to
cf5c568
Compare
ec88727 to
42c6bb3
Compare
…ler CompositionLocal
…s for type safety and optimization
…accessibility, cache race condition
42c6bb3 to
8d22515
Compare
|
all addressed, build passed. |

Problem
Artist names joined by conjunctions (e.g., "Tiziano Ferro e Ariete") were not split correctly. Conjunction words like "e" (Italian for "and") appeared as separate clickable artists. Additionally:
navigationEndpoint, making the second artist navigate to the wrong page (e.g., clicking "Ariete" opened Tiziano Ferro)mapNotNullinfromMusicTwoRowItemRendererfiltered out artists withnullIDs beforeresolveArtistIds()could resolve themCause
splitArtistsByConjunction()only checked for standalone conjunction runs but did not split runs containing conjunction wordsnavigationEndpointArtistEntitywas only created/updated when subscribing to an artist, not when simply viewing the artist pageMIGRATION_37_38conflicted with Room's auto-migration system; Room could not resolve the migration path from 37 to 38ClickableArtistTextand plain-text fallbacks used a single separator for all pairs, producing "A & B & C" for 3+ artistsSolution
Navigation fix (ef84c0a)
navigationEndpoint; subsequent parts getnullsoresolveArtistIds()handles themmapNotNullwith.mapinfromMusicTwoRowItemRendererso null-ID artists are preservedmetrolist_strings.xmlviagetArtistSeparator()instead of hardcoded stringsClickable artists (5703c42)
ClickableArtistTextcomposable inItems.ktwith two overloads (ArtistEntity,MediaMetadata.Artist)AnnotatedStringwithpushStringAnnotation("artist_$id", id)and renders viaClickableTextartist/${id}viaNavControllerstringResource(R.string.and)LocalNavControllerCompositionLocal (following project's existing pattern) instead of threadingnavControllerthrough 40+ filesSongListItem,SongGridItem,AlbumListItem,MediaMetadataListItemto render clickable artists viaLocalNavControllerSongMenu,AlbumMenu,YouTubeSongMenu,QueueMenu,PlayerMenu,Library.kt,Dialog.kt) and screen composables toLocalNavController.current, removing ~177 lines ofnavControllerparameter boilerplatePersistent artist thumbnails (9373e83)
ArtistViewModel.fetchArtistsFromYTM(), save/update theArtistEntityin the local database with thumbnail, name, and channelId after each successful API callDB migration fix (9abbce6)
MIGRATION_37_38withAutoMigration(from = 37, to = 38)— Room natively handles adding a nullable column with DEFAULTComma+conjunction for 3+ artists (077c89d)
ClickableArtistTextnow renders "A, B & C" for 3+ artists, "A & B" for 2, and just "A" for 1joinToArtistString()extension function inUtils.ktfor uniform string-based formattingMiniPlayer,MusicService,MediaLibrarySessionCallback,ListenTogetherManagerto use the new formatterAlbum page artist color (a3c5790)
ClickableArtistTexton AlbumScreen now usescolorScheme.secondaryinstead of defaultonSurface, matching song item stylingCodeRabbit review fixes (a3c5790)
toYTItem()now usesthumbnail.takeIf { it.isNotBlank() }for nullable thumbnail fields (playlist, artist, podcast), preserving null semantics for absent thumbnailsjoinToArtistString()instead of rawjoinToString(), ensuring consistent "A, B & C" formatting everywhereresolvedPage.sections) instead offilteredSections, so hide-* settings toggles don't break offline cache contentTesting
./gradlew :app:assembleFossDebug— SUCCESSapp/build/outputs/apk/foss/debug/app-foss-debug.apkSummary by CodeRabbit
New Features
Improvements
Chores