mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Use WebImage fix
This commit is contained in:
@@ -31,28 +31,19 @@ struct ChapterView: View {
|
||||
}
|
||||
|
||||
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: chapter.image) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
WebImage(url: chapter.image)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
}
|
||||
} else {
|
||||
WebImage(url: chapter.image)
|
||||
.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
|
||||
}
|
||||
.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 {
|
||||
|
@@ -221,23 +221,14 @@ struct PlayerControls: View {
|
||||
let video = item.video,
|
||||
let url = thumbnails.best(video)
|
||||
{
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -72,35 +72,20 @@ struct VideoBanner: View {
|
||||
|
||||
@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"))
|
||||
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
}
|
||||
#if os(tvOS)
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
#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
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private var thumbnailWidth: Double {
|
||||
|
@@ -421,32 +421,21 @@ struct VideoCell: View {
|
||||
private var thumbnailImage: some View {
|
||||
Group {
|
||||
let url = thumbnails.best(video)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.onFailure { _ in
|
||||
guard let url = url else { return }
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.onFailure { _ in
|
||||
guard let url = url else { return }
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
}
|
||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||
.modifier(AspectRatioModifier())
|
||||
|
@@ -37,23 +37,15 @@ struct ChannelCell: View {
|
||||
.opacity(0.6)
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: channel.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
|
||||
WebImage(url: channel.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: channel.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
.indicator(.activity)
|
||||
.frame(width: 88, height: 88)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.indicator(.activity)
|
||||
.frame(width: 88, height: 88)
|
||||
.clipShape(Circle())
|
||||
|
||||
DetailBadge(text: channel.name, style: .prominent)
|
||||
|
||||
|
@@ -37,23 +37,14 @@ struct ChannelPlaylistCell: View {
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: playlist.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
WebImage(url: playlist.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: playlist.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
.indicator(.activity)
|
||||
.frame(width: 165, height: 88)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
}
|
||||
.indicator(.activity)
|
||||
.frame(width: 165, height: 88)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
Group {
|
||||
DetailBadge(text: playlist.title, style: .prominent)
|
||||
.lineLimit(2)
|
||||
|
@@ -271,22 +271,13 @@ struct ControlsBar: View {
|
||||
private var authorAvatar: some View {
|
||||
Group {
|
||||
if let video = model.currentItem?.video, let url = video.channel.thumbnailURL {
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
} else {
|
||||
ZStack {
|
||||
Color(white: 0.6)
|
||||
|
Reference in New Issue
Block a user