mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Fix favorites not loading (#156)
Fixes bug introduced in #150 that prevented the favorites page from loading anything Also remembers the sort for each favorites tab
This commit is contained in:
parent
a0b9ac7673
commit
13c2bb32d2
12 changed files with 110 additions and 50 deletions
|
|
@ -6,6 +6,7 @@ import androidx.room.OnConflictStrategy
|
|||
import androidx.room.Query
|
||||
import com.github.damontecres.wholphin.data.model.JellyfinUser
|
||||
import com.github.damontecres.wholphin.data.model.LibraryDisplayInfo
|
||||
import com.github.damontecres.wholphin.ui.toServerString
|
||||
import java.util.UUID
|
||||
|
||||
@Dao
|
||||
|
|
@ -13,12 +14,17 @@ interface LibraryDisplayInfoDao {
|
|||
fun getItem(
|
||||
user: JellyfinUser,
|
||||
itemId: UUID,
|
||||
): LibraryDisplayInfo? = getItem(user.rowId, itemId.toServerString())
|
||||
|
||||
fun getItem(
|
||||
user: JellyfinUser,
|
||||
itemId: String,
|
||||
): LibraryDisplayInfo? = getItem(user.rowId, itemId)
|
||||
|
||||
@Query("SELECT * from LibraryDisplayInfo WHERE userId=:userId AND itemId=:itemId")
|
||||
fun getItem(
|
||||
userId: Int,
|
||||
itemId: UUID,
|
||||
itemId: String,
|
||||
): LibraryDisplayInfo?
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import androidx.room.ForeignKey
|
|||
import androidx.room.Ignore
|
||||
import androidx.room.Index
|
||||
import com.github.damontecres.wholphin.ui.data.SortAndDirection
|
||||
import com.github.damontecres.wholphin.ui.toServerString
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import kotlinx.serialization.UseSerializers
|
||||
|
|
@ -31,10 +32,17 @@ import java.util.UUID
|
|||
@Serializable
|
||||
data class LibraryDisplayInfo(
|
||||
val userId: Int,
|
||||
val itemId: UUID,
|
||||
val itemId: String,
|
||||
val sort: ItemSortBy,
|
||||
val direction: SortOrder,
|
||||
) {
|
||||
constructor(
|
||||
userId: Int,
|
||||
itemId: UUID,
|
||||
sort: ItemSortBy,
|
||||
direction: SortOrder,
|
||||
) : this(userId, itemId.toServerString(), sort, direction)
|
||||
|
||||
@Ignore @Transient
|
||||
val sortAndDirection = SortAndDirection(sort, direction)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue