mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-24 03:36:51 +00:00
refactor: update image handling in Episode dto to use imageUrlPrefix and JellyfinImageHelper
This commit is contained in:
@@ -37,6 +37,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import hu.bbara.purefin.common.ui.MediaMetaChip
|
||||
import hu.bbara.purefin.common.ui.PurefinWaitingScreen
|
||||
import hu.bbara.purefin.common.ui.components.MediaHero
|
||||
import hu.bbara.purefin.core.data.image.JellyfinImageHelper
|
||||
import hu.bbara.purefin.core.data.navigation.EpisodeDto
|
||||
import hu.bbara.purefin.core.data.navigation.LocalNavigationBackStack
|
||||
import hu.bbara.purefin.core.data.navigation.Route
|
||||
@@ -45,6 +46,7 @@ import hu.bbara.purefin.core.model.Episode
|
||||
import hu.bbara.purefin.feature.download.DownloadState
|
||||
import hu.bbara.purefin.feature.shared.content.episode.EpisodeScreenViewModel
|
||||
import hu.bbara.purefin.ui.theme.AppTheme
|
||||
import org.jellyfin.sdk.model.api.ImageType
|
||||
import java.util.UUID
|
||||
|
||||
@Composable
|
||||
@@ -162,7 +164,7 @@ private fun EpisodeHeroSection(
|
||||
.height(sectionHeight)
|
||||
) {
|
||||
MediaHero(
|
||||
imageUrl = episode.heroImageUrl,
|
||||
imageUrl = JellyfinImageHelper.finishImageUrl(episode.imageUrlPrefix, ImageType.PRIMARY),
|
||||
backgroundColor = scheme.background,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
@@ -258,7 +260,7 @@ private fun previewEpisode(): Episode {
|
||||
progress = 63.0,
|
||||
watched = false,
|
||||
format = "4K",
|
||||
heroImageUrl = "https://images.unsplash.com/photo-1500530855697-b586d89ba3ee",
|
||||
imageUrlPrefix = "https://images.unsplash.com/photo-1500530855697-b586d89ba3ee",
|
||||
cast = listOf(
|
||||
CastMember("Adam Scott", "Mark Scout", null),
|
||||
CastMember("Britt Lower", "Helly R.", null),
|
||||
|
||||
@@ -65,6 +65,7 @@ import hu.bbara.purefin.common.ui.components.MediaProgressBar
|
||||
import hu.bbara.purefin.common.ui.components.MediaResumeButton
|
||||
import hu.bbara.purefin.common.ui.components.PurefinAsyncImage
|
||||
import hu.bbara.purefin.common.ui.components.WatchStateIndicator
|
||||
import hu.bbara.purefin.core.data.image.JellyfinImageHelper
|
||||
import hu.bbara.purefin.core.data.navigation.EpisodeDto
|
||||
import hu.bbara.purefin.core.data.navigation.LocalNavigationManager
|
||||
import hu.bbara.purefin.core.data.navigation.Route
|
||||
@@ -75,6 +76,7 @@ import hu.bbara.purefin.core.model.Series
|
||||
import hu.bbara.purefin.feature.download.DownloadState
|
||||
import hu.bbara.purefin.feature.shared.content.series.SeriesViewModel
|
||||
import hu.bbara.purefin.player.PlayerActivity
|
||||
import org.jellyfin.sdk.model.api.ImageType
|
||||
|
||||
@Composable
|
||||
internal fun SeriesTopBar(
|
||||
@@ -347,7 +349,7 @@ private fun EpisodeCard(
|
||||
.border(1.dp, scheme.outlineVariant, RoundedCornerShape(12.dp))
|
||||
) {
|
||||
PurefinAsyncImage(
|
||||
model = episode.heroImageUrl,
|
||||
model = JellyfinImageHelper.finishImageUrl(episode.imageUrlPrefix, ImageType.PRIMARY),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentScale = ContentScale.Crop
|
||||
|
||||
@@ -272,7 +272,7 @@ private fun previewSeries(): Series {
|
||||
progress = 100.0,
|
||||
watched = true,
|
||||
format = "4K",
|
||||
heroImageUrl = "https://images.unsplash.com/photo-1497032205916-ac775f0649ae",
|
||||
imageUrlPrefix = "https://images.unsplash.com/photo-1497032205916-ac775f0649ae",
|
||||
cast = emptyList()
|
||||
),
|
||||
Episode(
|
||||
@@ -288,7 +288,7 @@ private fun previewSeries(): Series {
|
||||
progress = 34.0,
|
||||
watched = false,
|
||||
format = "4K",
|
||||
heroImageUrl = "https://images.unsplash.com/photo-1520034475321-cbe63696469a",
|
||||
imageUrlPrefix = "https://images.unsplash.com/photo-1520034475321-cbe63696469a",
|
||||
cast = emptyList()
|
||||
)
|
||||
)
|
||||
@@ -306,7 +306,7 @@ private fun previewSeries(): Series {
|
||||
progress = null,
|
||||
watched = false,
|
||||
format = "4K",
|
||||
heroImageUrl = "https://images.unsplash.com/photo-1500534314209-a25ddb2bd429",
|
||||
imageUrlPrefix = "https://images.unsplash.com/photo-1500534314209-a25ddb2bd429",
|
||||
cast = emptyList()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -57,7 +57,10 @@ internal fun ContinueWatchingCard(
|
||||
prefixImageUrl = item.movie?.imageUrlPrefix,
|
||||
imageType = ImageType.PRIMARY
|
||||
)
|
||||
BaseItemKind.EPISODE -> item.episode?.heroImageUrl
|
||||
BaseItemKind.EPISODE -> JellyfinImageHelper.finishImageUrl(
|
||||
prefixImageUrl = item.episode?.imageUrlPrefix,
|
||||
imageType = ImageType.PRIMARY
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import hu.bbara.purefin.common.ui.components.PurefinAsyncImage
|
||||
import hu.bbara.purefin.core.data.image.JellyfinImageHelper
|
||||
import hu.bbara.purefin.feature.shared.home.NextUpItem
|
||||
import org.jellyfin.sdk.model.UUID
|
||||
import org.jellyfin.sdk.model.api.ImageType
|
||||
|
||||
@Composable
|
||||
internal fun NextUpCard(
|
||||
@@ -55,7 +57,7 @@ internal fun NextUpCard(
|
||||
.background(scheme.surface)
|
||||
) {
|
||||
PurefinAsyncImage(
|
||||
model = item.episode.heroImageUrl,
|
||||
model = JellyfinImageHelper.finishImageUrl(item.episode.imageUrlPrefix, ImageType.PRIMARY),
|
||||
contentDescription = item.primaryText,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentScale = ContentScale.Crop
|
||||
|
||||
Reference in New Issue
Block a user