Do not return unused fields in DetailedSong

This commit is contained in:
vfsfitvnm
2022-08-03 21:09:08 +02:00
parent 194864bcb4
commit 61c8552ad0
12 changed files with 68 additions and 58 deletions

View File

@@ -15,19 +15,6 @@ data class Song(
val likedAt: Long? = null,
val totalPlayTimeMs: Long = 0
) {
val formattedTotalPlayTime: String
get() {
val seconds = totalPlayTimeMs / 1000
val hours = seconds / 3600
return when {
hours == 0L -> "${seconds / 60}m"
hours < 24L -> "${hours}h"
else -> "${hours / 24}d"
}
}
fun toggleLike(): Song {
return copy(
likedAt = if (likedAt == null) System.currentTimeMillis() else null