Dependency updates & removing unused code (#70)

Just bumping dependencies and deleting some unused code. No user facing
changes
This commit is contained in:
damontecres 2025-10-26 18:17:47 -04:00 committed by GitHub
parent 1c1e64a5b9
commit 89b9364807
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 367 additions and 844 deletions

View file

@ -8,6 +8,8 @@ import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.github.damontecres.wholphin.data.model.ItemPlayback
import com.github.damontecres.wholphin.data.model.JellyfinServer
import com.github.damontecres.wholphin.data.model.JellyfinUser
import com.github.damontecres.wholphin.data.model.NavDrawerPinnedItem
import org.jellyfin.sdk.model.serializer.toUUID
import java.util.UUID

View file

@ -5,6 +5,7 @@ import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.damontecres.wholphin.data.model.ItemPlayback
import com.github.damontecres.wholphin.data.model.JellyfinUser
import java.util.UUID
@Dao

View file

@ -1,66 +1,19 @@
package com.github.damontecres.wholphin.data
import androidx.room.ColumnInfo
import androidx.room.Dao
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import androidx.room.Relation
import androidx.room.Transaction
import androidx.room.Update
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
import com.github.damontecres.wholphin.data.model.JellyfinServer
import com.github.damontecres.wholphin.data.model.JellyfinServerUsers
import com.github.damontecres.wholphin.data.model.JellyfinUser
import java.util.UUID
@Entity(tableName = "servers")
data class JellyfinServer(
@PrimaryKey val id: UUID,
val name: String?,
val url: String,
)
@Entity(
tableName = "users",
foreignKeys = [
ForeignKey(
entity = JellyfinServer::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("serverId"),
onDelete = ForeignKey.CASCADE,
),
],
indices = [Index("id", "serverId", unique = true)],
)
data class JellyfinUser(
@PrimaryKey(autoGenerate = true)
val rowId: Int = 0,
@ColumnInfo(index = true)
val id: UUID,
val name: String?,
@ColumnInfo(index = true)
val serverId: UUID,
val accessToken: String?,
) {
override fun toString(): String =
"JellyfinUser(rowId=$rowId, id=$id, name=$name, serverId=$serverId, accessToken=${accessToken.isNotNullOrBlank()})"
}
data class JellyfinServerUsers(
@Embedded val server: JellyfinServer,
@Relation(
parentColumn = "id",
entityColumn = "serverId",
)
val users: List<JellyfinUser>,
)
@Dao
interface JellyfinServerDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
@Insert(onConflict = OnConflictStrategy.Companion.IGNORE)
fun addServer(server: JellyfinServer): Long
@Update
@ -74,7 +27,7 @@ interface JellyfinServerDao {
}
}
@Insert(onConflict = OnConflictStrategy.IGNORE)
@Insert(onConflict = OnConflictStrategy.Companion.IGNORE)
fun addUser(user: JellyfinUser): Long
@Update

View file

@ -4,6 +4,7 @@ import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.github.damontecres.wholphin.data.model.JellyfinUser
import com.github.damontecres.wholphin.data.model.NavDrawerPinnedItem
@Dao

View file

@ -7,6 +7,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.core.content.edit
import androidx.datastore.core.DataStore
import com.github.damontecres.wholphin.data.model.JellyfinServer
import com.github.damontecres.wholphin.data.model.JellyfinUser
import com.github.damontecres.wholphin.preferences.AppPreferences
import com.github.damontecres.wholphin.ui.toServerString
import dagger.hilt.android.qualifiers.ApplicationContext

View file

@ -4,13 +4,14 @@ package com.github.damontecres.wholphin.data.model
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Ignore
import androidx.room.Index
import androidx.room.PrimaryKey
import com.github.damontecres.wholphin.data.JellyfinUser
import com.github.damontecres.wholphin.preferences.UserPreferences
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
import com.github.damontecres.wholphin.ui.letNotEmpty
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import kotlinx.serialization.UseSerializers
import org.jellyfin.sdk.model.api.BaseItemDto
import org.jellyfin.sdk.model.api.MediaSourceInfo
@ -43,9 +44,13 @@ data class ItemPlayback(
val audioIndex: Int = TrackIndex.UNSPECIFIED,
val subtitleIndex: Int = TrackIndex.UNSPECIFIED,
) {
@Transient val audioIndexEnabled = audioIndex >= 0
@Transient
@Ignore
val audioIndexEnabled = audioIndex >= 0
@Transient val subtitleIndexEnabled = subtitleIndex >= 0
@Transient
@Ignore
val subtitleIndexEnabled = subtitleIndex >= 0
}
/**

View file

@ -0,0 +1,53 @@
package com.github.damontecres.wholphin.data.model
import androidx.room.ColumnInfo
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.Relation
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
import java.util.UUID
@Entity(tableName = "servers")
data class JellyfinServer(
@PrimaryKey val id: UUID,
val name: String?,
val url: String,
)
@Entity(
tableName = "users",
foreignKeys = [
ForeignKey(
entity = JellyfinServer::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("serverId"),
onDelete = ForeignKey.CASCADE,
),
],
indices = [Index("id", "serverId", unique = true)],
)
data class JellyfinUser(
@PrimaryKey(autoGenerate = true)
val rowId: Int = 0,
@ColumnInfo(index = true)
val id: UUID,
val name: String?,
@ColumnInfo(index = true)
val serverId: UUID,
val accessToken: String?,
) {
override fun toString(): String =
"JellyfinUser(rowId=$rowId, id=$id, name=$name, serverId=$serverId, accessToken=${accessToken.isNotNullOrBlank()})"
}
data class JellyfinServerUsers(
@Embedded val server: JellyfinServer,
@Relation(
parentColumn = "id",
entityColumn = "serverId",
)
val users: List<JellyfinUser>,
)

View file

@ -2,7 +2,6 @@ package com.github.damontecres.wholphin.data.model
import androidx.room.Entity
import androidx.room.ForeignKey
import com.github.damontecres.wholphin.data.JellyfinUser
enum class NavPinType {
PINNED,

View file

@ -0,0 +1,17 @@
package com.github.damontecres.wholphin.data.model
sealed interface Trailer {
val name: String
}
data class LocalTrailer(
val baseItem: BaseItem,
) : Trailer {
override val name: String
get() = baseItem.name ?: ""
}
data class RemoteTrailer(
override val name: String,
val url: String,
) : Trailer