mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Simplify PlaybackViewModel (#252)
`PlaybackViewModel` was becoming very unwieldy at over 1,300 LOC. This PR breaks it up and simplifies some fields so it's easier to work with. There are no user facing changes
This commit is contained in:
parent
1fd497d18c
commit
4517dcd0cf
11 changed files with 643 additions and 600 deletions
|
|
@ -1,8 +1,10 @@
|
|||
package com.github.damontecres.wholphin.data.model
|
||||
|
||||
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisodeIds
|
||||
import com.github.damontecres.wholphin.ui.formatDateTime
|
||||
import com.github.damontecres.wholphin.ui.nav.Destination
|
||||
import com.github.damontecres.wholphin.ui.seasonEpisode
|
||||
import com.github.damontecres.wholphin.ui.seasonEpisodePadded
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import org.jellyfin.sdk.api.client.ApiClient
|
||||
|
|
@ -32,6 +34,18 @@ data class BaseItem(
|
|||
get() =
|
||||
if (type == BaseItemKind.EPISODE) data.seasonEpisode + " - " + name else data.productionYear?.toString()
|
||||
|
||||
val subtitleLong: String? by lazy {
|
||||
if (type == BaseItemKind.EPISODE) {
|
||||
buildList {
|
||||
add(data.seasonEpisodePadded)
|
||||
add(data.name)
|
||||
add(data.premiereDate?.let { formatDateTime(it) })
|
||||
}.filterNotNull().joinToString(" - ")
|
||||
} else {
|
||||
data.productionYear?.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@Transient
|
||||
val indexNumber = data.indexNumber ?: dateAsIndex()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue