mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Model improvements
This commit is contained in:
@@ -70,20 +70,37 @@ struct VideoBanner: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var smallThumbnail: some View {
|
||||
WebImage(url: video?.thumbnailURL(quality: .medium))
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
@ViewBuilder private var smallThumbnail: some View {
|
||||
let url = video?.thumbnailURL(quality: .medium)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private var thumbnailWidth: Double {
|
||||
|
@@ -382,7 +382,7 @@ struct VideoCell: View {
|
||||
|
||||
HStack(alignment: .center) {
|
||||
if saveHistory,
|
||||
watchedVideoStyle == .badge || watchedVideoStyle == .both,
|
||||
watchedVideoStyle.isShowingBadge,
|
||||
watch?.finished ?? false
|
||||
{
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
@@ -419,27 +419,32 @@ struct VideoCell: View {
|
||||
|
||||
private var thumbnailImage: some View {
|
||||
Group {
|
||||
if let url = thumbnails.best(video) {
|
||||
let url = thumbnails.best(video)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.onFailure { _ in
|
||||
guard let url = url else { return }
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
.indicator(.activity)
|
||||
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
ZStack {
|
||||
Color("PlaceholderColor")
|
||||
Image(systemName: "exclamationmark.triangle")
|
||||
}
|
||||
.font(.system(size: 30))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||
|
Reference in New Issue
Block a user