mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Load movie & tv recommendations asynchronously (#183)
Previously all of the rows on the recommended tab for Movies & TV Shows were loaded sequentially before any results were shown. This is not a great experience because some of the queries (eg top rated unwatched) can take a while sometimes. This PR starts displaying content once the first 1 or 2 rows is loaded and then shows placeholders while the rest are querying. Finally the row queries are now mostly independent so if one errors out, the rest of the rows will still be displayed. Closes #180
This commit is contained in:
parent
0fb1a69556
commit
98fc996bd5
6 changed files with 422 additions and 179 deletions
|
|
@ -42,3 +42,29 @@ sealed interface RowLoadingState {
|
|||
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface HomeRowLoadingState {
|
||||
val title: String
|
||||
|
||||
data class Pending(
|
||||
override val title: String,
|
||||
) : HomeRowLoadingState
|
||||
|
||||
data class Loading(
|
||||
override val title: String,
|
||||
) : HomeRowLoadingState
|
||||
|
||||
data class Success(
|
||||
override val title: String,
|
||||
val items: List<BaseItem?>,
|
||||
) : HomeRowLoadingState
|
||||
|
||||
data class Error(
|
||||
override val title: String,
|
||||
val message: String? = null,
|
||||
val exception: Throwable? = null,
|
||||
) : HomeRowLoadingState {
|
||||
val localizedMessage: String =
|
||||
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue