Do not return unused fields in DetailedSong
This commit is contained in:
@@ -70,7 +70,7 @@ fun InFavoritesMediaItemMenu(
|
||||
onDismiss = onDismiss,
|
||||
onRemoveFromFavorites = {
|
||||
query {
|
||||
Database.update(song.song.toggleLike())
|
||||
Database.like(song.id, if (song.likedAt == null) System.currentTimeMillis() else null)
|
||||
}
|
||||
},
|
||||
modifier = modifier
|
||||
@@ -94,15 +94,13 @@ fun InHistoryMediaItemMenu(
|
||||
if (isHiding) {
|
||||
ConfirmationDialog(
|
||||
text = "Do you really hide this song? Its playback time and cache will be wiped.\nThis action is irreversible.",
|
||||
onDismiss = {
|
||||
isHiding = false
|
||||
},
|
||||
onDismiss = { isHiding = false },
|
||||
onConfirm = {
|
||||
(onDismiss ?: menuState::hide).invoke()
|
||||
query {
|
||||
// Not sure we can to this here
|
||||
binder?.cache?.removeResource(song.song.id)
|
||||
Database.update(song.song.copy(totalPlayTimeMs = 0))
|
||||
binder?.cache?.removeResource(song.id)
|
||||
Database.incrementTotalPlayTimeMs(song.id, -song.totalPlayTimeMs)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -111,9 +109,7 @@ fun InHistoryMediaItemMenu(
|
||||
NonQueuedMediaItemMenu(
|
||||
mediaItem = song.asMediaItem,
|
||||
onDismiss = onDismiss,
|
||||
onHideFromDatabase = {
|
||||
isHiding = true
|
||||
},
|
||||
onHideFromDatabase = { isHiding = true },
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
@@ -134,7 +130,7 @@ fun InPlaylistMediaItemMenu(
|
||||
transaction {
|
||||
Database.delete(
|
||||
SongPlaylistMap(
|
||||
songId = song.song.id,
|
||||
songId = song.id,
|
||||
playlistId = playlistId,
|
||||
position = positionInPlaylist
|
||||
)
|
||||
@@ -182,9 +178,7 @@ fun NonQueuedMediaItemMenu(
|
||||
onPlayNext = {
|
||||
binder?.player?.addNext(mediaItem)
|
||||
},
|
||||
onEnqueue = {
|
||||
binder?.player?.enqueue(mediaItem)
|
||||
},
|
||||
onEnqueue = { binder?.player?.enqueue(mediaItem) },
|
||||
onRemoveFromPlaylist = onRemoveFromPlaylist,
|
||||
onHideFromDatabase = onHideFromDatabase,
|
||||
onRemoveFromFavorites = onRemoveFromFavorites,
|
||||
|
||||
@@ -251,7 +251,7 @@ fun AlbumScreen(browseId: String) {
|
||||
songs.forEachIndexed { index, song ->
|
||||
Database.insert(
|
||||
SongPlaylistMap(
|
||||
songId = song.song.id,
|
||||
songId = song.id,
|
||||
playlistId = playlistId,
|
||||
position = index
|
||||
)
|
||||
@@ -320,13 +320,13 @@ fun AlbumScreen(browseId: String) {
|
||||
|
||||
itemsIndexed(
|
||||
items = songs,
|
||||
key = { _, song -> song.song.id },
|
||||
key = { _, song -> song.id },
|
||||
contentType = { _, song -> song }
|
||||
) { index, song ->
|
||||
SongItem(
|
||||
title = song.song.title,
|
||||
authors = song.song.artistsText ?: albumResult?.getOrNull()?.authorsText,
|
||||
durationText = song.song.durationText,
|
||||
title = song.title,
|
||||
authors = song.artistsText ?: albumResult?.getOrNull()?.authorsText,
|
||||
durationText = song.durationText,
|
||||
onClick = {
|
||||
binder?.stopRadio()
|
||||
binder?.player?.forcePlayAtIndex(
|
||||
|
||||
@@ -247,7 +247,7 @@ fun ArtistScreen(browseId: String) {
|
||||
|
||||
itemsIndexed(
|
||||
items = songs,
|
||||
key = { _, song -> song.song.id },
|
||||
key = { _, song -> song.id },
|
||||
contentType = { _, song -> song },
|
||||
) { index, song ->
|
||||
SongItem(
|
||||
|
||||
@@ -74,7 +74,7 @@ fun BuiltInPlaylistScreen(builtInPlaylist: BuiltInPlaylist) {
|
||||
BuiltInPlaylist.Offline -> Database.songsWithContentLength().map { songs ->
|
||||
songs.filter { song ->
|
||||
song.contentLength?.let {
|
||||
binder?.cache?.isCached(song.song.id, 0, song.contentLength)
|
||||
binder?.cache?.isCached(song.id, 0, song.contentLength)
|
||||
} ?: false
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ fun BuiltInPlaylistScreen(builtInPlaylist: BuiltInPlaylist) {
|
||||
|
||||
itemsIndexed(
|
||||
items = songs,
|
||||
key = { _, song -> song.song.id },
|
||||
key = { _, song -> song.id },
|
||||
contentType = { _, song -> song },
|
||||
) { index, song ->
|
||||
SongItem(
|
||||
|
||||
@@ -625,9 +625,7 @@ fun HomeScreen() {
|
||||
|
||||
itemsIndexed(
|
||||
items = songCollection,
|
||||
key = { _, song ->
|
||||
song.song.id
|
||||
},
|
||||
key = { _, song -> song.id },
|
||||
contentType = { _, song -> song }
|
||||
) { index, song ->
|
||||
SongItem(
|
||||
@@ -652,7 +650,7 @@ fun HomeScreen() {
|
||||
.align(Alignment.BottomCenter)
|
||||
) {
|
||||
BasicText(
|
||||
text = song.song.formattedTotalPlayTime,
|
||||
text = song.formattedTotalPlayTime,
|
||||
style = typography.xxs.semiBold.center.color(Color.White),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
|
||||
@@ -242,7 +242,7 @@ fun LocalPlaylistScreen(playlistId: Long) {
|
||||
|
||||
itemsIndexed(
|
||||
items = playlistWithSongs.songs,
|
||||
key = { _, song -> song.song.id },
|
||||
key = { _, song -> song.id },
|
||||
contentType = { _, song -> song },
|
||||
) { index, song ->
|
||||
SongItem(
|
||||
@@ -301,7 +301,7 @@ fun LocalPlaylistScreen(playlistId: Long) {
|
||||
|
||||
Database.update(
|
||||
SongPlaylistMap(
|
||||
songId = playlistWithSongs.songs[index].song.id,
|
||||
songId = playlistWithSongs.songs[index].id,
|
||||
playlistId = playlistWithSongs.playlist.id,
|
||||
position = reachedIndex
|
||||
)
|
||||
|
||||
@@ -83,10 +83,10 @@ fun SongItem(
|
||||
trailingContent: (@Composable () -> Unit)? = null
|
||||
) {
|
||||
SongItem(
|
||||
thumbnailModel = song.song.thumbnailUrl?.thumbnail(thumbnailSize),
|
||||
title = song.song.title,
|
||||
authors = song.song.artistsText ?: "",
|
||||
durationText = song.song.durationText,
|
||||
thumbnailModel = song.thumbnailUrl?.thumbnail(thumbnailSize),
|
||||
title = song.title,
|
||||
authors = song.artistsText ?: "",
|
||||
durationText = song.durationText,
|
||||
menuContent = menuContent,
|
||||
onClick = onClick,
|
||||
onThumbnailContent = onThumbnailContent,
|
||||
|
||||
Reference in New Issue
Block a user