musikr: fix data object equality failing

Turns out StoredCover's equality impl was busted.
This commit is contained in:
Alexander Capehart
2025-07-05 18:35:30 -06:00
parent 412278a137
commit 2a4417c82a
2 changed files with 15 additions and 6 deletions
@@ -105,6 +105,15 @@ class MutableStoredCovers(
} }
} }
private class StoredCover(private val inner: FDCover) : FDCover by inner { private data class StoredCover(private val inner: FDCover) : FDCover by inner {
override val id = PREFIX + inner.id override val id = PREFIX + inner.id
// For some reason delegation takes priority over the data class definition?
// Manually define equals/hashCode instead to avoid breaking the equals impl.
override fun equals(other: Any?): Boolean {
return other is StoredCover && inner == other.inner
}
override fun hashCode(): Int = id.hashCode()
} }
@@ -28,11 +28,11 @@ import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
internal data class LibraryImpl( internal data class LibraryImpl(
override val songs: Collection<SongImpl>, override val songs: Set<SongImpl>,
override val albums: Collection<AlbumImpl>, override val albums: Set<AlbumImpl>,
override val artists: Collection<ArtistImpl>, override val artists: Set<ArtistImpl>,
override val genres: Collection<GenreImpl>, override val genres: Set<GenreImpl>,
override val playlists: Collection<PlaylistImpl>, override val playlists: Set<PlaylistImpl>,
private val storedPlaylists: StoredPlaylists, private val storedPlaylists: StoredPlaylists,
private val playlistInterpreter: PlaylistInterpreter private val playlistInterpreter: PlaylistInterpreter
) : MutableLibrary { ) : MutableLibrary {