implement (#561)
This commit is contained in:
parent
2a3617bd47
commit
ace339bd1a
|
@ -34,7 +34,7 @@ extension Defaults.Keys {
|
||||||
static let nextUpPosterType = Key<PosterType>("nextUpPosterType", default: .portrait, suite: .generalSuite)
|
static let nextUpPosterType = Key<PosterType>("nextUpPosterType", default: .portrait, suite: .generalSuite)
|
||||||
static let recentlyAddedPosterType = Key<PosterType>("recentlyAddedPosterType", default: .portrait, suite: .generalSuite)
|
static let recentlyAddedPosterType = Key<PosterType>("recentlyAddedPosterType", default: .portrait, suite: .generalSuite)
|
||||||
static let latestInLibraryPosterType = Key<PosterType>("latestInLibraryPosterType", default: .portrait, suite: .generalSuite)
|
static let latestInLibraryPosterType = Key<PosterType>("latestInLibraryPosterType", default: .portrait, suite: .generalSuite)
|
||||||
static let recommendedPosterType = Key<PosterType>("recommendedPosterType", default: .portrait, suite: .generalSuite)
|
static let similarPosterType = Key<PosterType>("similarPosterType", default: .portrait, suite: .generalSuite)
|
||||||
static let searchPosterType = Key<PosterType>("searchPosterType", default: .portrait, suite: .generalSuite)
|
static let searchPosterType = Key<PosterType>("searchPosterType", default: .portrait, suite: .generalSuite)
|
||||||
|
|
||||||
enum Episodes {
|
enum Episodes {
|
||||||
|
|
|
@ -59,7 +59,8 @@ struct ImageView<ImageType: View, PlaceholderView: View, FailureView: View>: Vie
|
||||||
} else if let blurHash = currentSource.blurHash {
|
} else if let blurHash = currentSource.blurHash {
|
||||||
BlurHashView(blurHash: blurHash, size: .Circle(radius: 16))
|
BlurHashView(blurHash: blurHash, size: .Circle(radius: 16))
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
Color.secondarySystemFill
|
||||||
|
.opacity(0.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ struct InitialFailureView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
Rectangle()
|
Color.secondarySystemFill
|
||||||
.foregroundColor(Color(UIColor.darkGray))
|
.opacity(0.5)
|
||||||
|
|
||||||
Text(initials)
|
Text(initials)
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
|
|
|
@ -55,8 +55,14 @@ struct PosterButton<Item: Poster, Content: View, ImageOverlay: View, ContextMenu
|
||||||
switch type {
|
switch type {
|
||||||
case .portrait:
|
case .portrait:
|
||||||
ImageView(item.portraitPosterImageSource(maxWidth: itemWidth))
|
ImageView(item.portraitPosterImageSource(maxWidth: itemWidth))
|
||||||
|
.failure {
|
||||||
|
InitialFailureView(item.displayName.initials)
|
||||||
|
}
|
||||||
case .landscape:
|
case .landscape:
|
||||||
ImageView(item.landscapePosterImageSources(maxWidth: itemWidth, single: singleImage))
|
ImageView(item.landscapePosterImageSources(maxWidth: itemWidth, single: singleImage))
|
||||||
|
.failure {
|
||||||
|
InitialFailureView(item.displayName.initials)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.overlay {
|
.overlay {
|
||||||
|
|
|
@ -6,12 +6,16 @@
|
||||||
// Copyright (c) 2022 Jellyfin & Jellyfin Contributors
|
// Copyright (c) 2022 Jellyfin & Jellyfin Contributors
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Defaults
|
||||||
import JellyfinAPI
|
import JellyfinAPI
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
extension ItemView {
|
extension ItemView {
|
||||||
struct SimilarItemsHStack: View {
|
struct SimilarItemsHStack: View {
|
||||||
|
|
||||||
|
@Default(.Customization.similarPosterType)
|
||||||
|
private var similarPosterType
|
||||||
|
|
||||||
@EnvironmentObject
|
@EnvironmentObject
|
||||||
private var router: ItemCoordinator.Router
|
private var router: ItemCoordinator.Router
|
||||||
let items: [BaseItemDto]
|
let items: [BaseItemDto]
|
||||||
|
@ -19,7 +23,7 @@ extension ItemView {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
PosterHStack(
|
PosterHStack(
|
||||||
title: L10n.recommended,
|
title: L10n.recommended,
|
||||||
type: .portrait,
|
type: similarPosterType,
|
||||||
items: items
|
items: items
|
||||||
)
|
)
|
||||||
.onSelect { item in
|
.onSelect { item in
|
||||||
|
|
|
@ -118,6 +118,9 @@ extension ItemView.CinematicScrollView {
|
||||||
VStack(alignment: .center, spacing: 10) {
|
VStack(alignment: .center, spacing: 10) {
|
||||||
ImageView(viewModel.item.imageURL(.logo, maxWidth: UIScreen.main.bounds.width))
|
ImageView(viewModel.item.imageURL(.logo, maxWidth: UIScreen.main.bounds.width))
|
||||||
.resizingMode(.aspectFit)
|
.resizingMode(.aspectFit)
|
||||||
|
.placeholder {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
.failure {
|
.failure {
|
||||||
Text(viewModel.item.displayName)
|
Text(viewModel.item.displayName)
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
|
|
|
@ -147,6 +147,9 @@ extension ItemView.CompactLogoScrollView {
|
||||||
VStack(alignment: .center, spacing: 10) {
|
VStack(alignment: .center, spacing: 10) {
|
||||||
ImageView(viewModel.item.imageURL(.logo, maxWidth: UIScreen.main.bounds.width, maxHeight: 100))
|
ImageView(viewModel.item.imageURL(.logo, maxWidth: UIScreen.main.bounds.width, maxHeight: 100))
|
||||||
.resizingMode(.aspectFit)
|
.resizingMode(.aspectFit)
|
||||||
|
.placeholder {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
.failure {
|
.failure {
|
||||||
Text(viewModel.item.displayName)
|
Text(viewModel.item.displayName)
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
|
|
|
@ -27,8 +27,8 @@ struct CustomizeViewsSettings: View {
|
||||||
var recentlyAddedPosterType
|
var recentlyAddedPosterType
|
||||||
@Default(.Customization.latestInLibraryPosterType)
|
@Default(.Customization.latestInLibraryPosterType)
|
||||||
var latestInLibraryPosterType
|
var latestInLibraryPosterType
|
||||||
@Default(.Customization.recommendedPosterType)
|
@Default(.Customization.similarPosterType)
|
||||||
var recommendedPosterType
|
var similarPosterType
|
||||||
@Default(.Customization.searchPosterType)
|
@Default(.Customization.searchPosterType)
|
||||||
var searchPosterType
|
var searchPosterType
|
||||||
@Default(.Customization.Library.gridPosterType)
|
@Default(.Customization.Library.gridPosterType)
|
||||||
|
@ -79,12 +79,11 @@ struct CustomizeViewsSettings: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Take time to do this for a lot of views
|
Picker(L10n.recommended, selection: $similarPosterType) {
|
||||||
// Picker(L10n.recommended, selection: $recommendedPosterType) {
|
ForEach(PosterType.allCases, id: \.self) { type in
|
||||||
// ForEach(PosterType.allCases, id: \.self) { type in
|
Text(type.localizedName).tag(type.rawValue)
|
||||||
// Text(type.localizedName).tag(type.rawValue)
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
Picker(L10n.search, selection: $searchPosterType) {
|
Picker(L10n.search, selection: $searchPosterType) {
|
||||||
ForEach(PosterType.allCases, id: \.self) { type in
|
ForEach(PosterType.allCases, id: \.self) { type in
|
||||||
|
|
Loading…
Reference in New Issue