Prioritize backdrop image for cinematic background (#893)

Co-authored-by: Brendan Perry <=>
This commit is contained in:
Brendan Perry 2023-10-31 04:22:55 +00:00 committed by GitHub
parent 333530a938
commit a49b0edc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -74,4 +74,13 @@ extension BaseItemDto: Poster {
]
}
}
func cinematicPosterImageSources() -> [ImageSource] {
switch type {
case .episode:
return [seriesImageSource(.backdrop, maxWidth: UIScreen.main.bounds.width)]
default:
return [imageSource(.backdrop, maxWidth: UIScreen.main.bounds.width)]
}
}
}

View File

@ -15,6 +15,7 @@ protocol Poster: Displayable, Hashable {
func portraitPosterImageSource(maxWidth: CGFloat) -> ImageSource
func landscapePosterImageSources(maxWidth: CGFloat, single: Bool) -> [ImageSource]
func cinematicPosterImageSources() -> [ImageSource]
}
extension Poster {
@ -22,4 +23,8 @@ extension Poster {
hasher.combine(displayTitle)
hasher.combine(subtitle)
}
func cinematicPosterImageSources() -> [ImageSource] {
[]
}
}

View File

@ -26,7 +26,7 @@ struct CinematicBackgroundView<Item: Poster>: View {
RotateContentView(proxy: proxy)
.onChange(of: viewModel.currentItem) { newItem in
proxy.update {
ImageView(newItem?.landscapePosterImageSources(maxWidth: UIScreen.main.bounds.width, single: false) ?? [])
ImageView(newItem?.cinematicPosterImageSources() ?? [])
.placeholder {
Color.clear
}