Revert "Fix images layout"

This reverts commit ee6e2370d22fb6d9013a4a05b51b4c6d155a3068.
This commit is contained in:
Arkadiusz Fal 2022-09-11 21:21:50 +02:00
parent 6ec59cf442
commit b320ffb540
5 changed files with 80 additions and 79 deletions

View File

@ -32,30 +32,28 @@ struct ChapterView: View {
} }
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View { @ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
Group { if #available(iOS 15, macOS 12, *) {
if #available(iOS 15, macOS 12, *) { CachedAsyncImage(url: chapter.image) { image in
CachedAsyncImage(url: chapter.image) { image in image
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
} else {
WebImage(url: chapter.image)
.resizable() .resizable()
.placeholder { } placeholder: {
ProgressView() Rectangle().foregroundColor(Color("PlaceholderColor"))
}
.indicator(.activity)
} }
} 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
} }
#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 { private var thumbnailWidth: Double {

View File

@ -73,30 +73,35 @@ struct VideoBanner: View {
@ViewBuilder private var smallThumbnail: some View { @ViewBuilder private var smallThumbnail: some View {
let url = video?.thumbnailURL(quality: .medium) let url = video?.thumbnailURL(quality: .medium)
Group { if #available(iOS 15, macOS 12, *) {
if #available(iOS 15, macOS 12, *) { CachedAsyncImage(url: url) { image in
CachedAsyncImage(url: url) { image in image
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
} else {
WebImage(url: url)
.resizable() .resizable()
.placeholder { } placeholder: {
ProgressView() 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
} 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
} }
#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 { private var thumbnailWidth: Double {

View File

@ -429,6 +429,9 @@ struct VideoCell: View {
} placeholder: { } placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor")) Rectangle().foregroundColor(Color("PlaceholderColor"))
} }
#if os(tvOS)
.frame(minHeight: 320)
#endif
} else { } else {
WebImage(url: url) WebImage(url: url)
.resizable() .resizable()
@ -440,11 +443,12 @@ struct VideoCell: View {
guard let url = url else { return } guard let url = url else { return }
thumbnails.insertUnloadable(url) thumbnails.insertUnloadable(url)
} }
#if os(tvOS)
.frame(minHeight: 320)
#endif
} }
} }
#if os(tvOS)
.frame(minHeight: 320)
#endif
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius)) .mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
.modifier(AspectRatioModifier()) .modifier(AspectRatioModifier())
} }

View File

@ -38,26 +38,23 @@ struct ChannelCell: View {
.opacity(0.6) .opacity(0.6)
} }
.foregroundColor(.secondary) .foregroundColor(.secondary)
if #available(iOS 15, macOS 12, *) {
Group { CachedAsyncImage(url: channel.thumbnailURL) { image in
if #available(iOS 15, macOS 12, *) { image
CachedAsyncImage(url: channel.thumbnailURL) { image in
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
} else {
WebImage(url: channel.thumbnailURL)
.resizable() .resizable()
.placeholder { } placeholder: {
Rectangle().fill(Color("PlaceholderColor")) Rectangle().foregroundColor(Color("PlaceholderColor"))
}
.indicator(.activity)
} }
} else {
WebImage(url: channel.thumbnailURL)
.resizable()
.placeholder {
Rectangle().fill(Color("PlaceholderColor"))
}
.indicator(.activity)
.frame(width: 88, height: 88)
.clipShape(Circle())
} }
.frame(width: 88, height: 88)
.clipShape(Circle())
DetailBadge(text: channel.name, style: .prominent) DetailBadge(text: channel.name, style: .prominent)

View File

@ -38,26 +38,23 @@ struct ChannelPlaylistCell: View {
} }
.foregroundColor(.secondary) .foregroundColor(.secondary)
Group { if #available(iOS 15, macOS 12, *) {
if #available(iOS 15, macOS 12, *) { CachedAsyncImage(url: playlist.thumbnailURL) { image in
CachedAsyncImage(url: playlist.thumbnailURL) { image in image
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
} else {
WebImage(url: playlist.thumbnailURL)
.resizable() .resizable()
.placeholder { } placeholder: {
Rectangle().fill(Color("PlaceholderColor")) Rectangle().foregroundColor(Color("PlaceholderColor"))
}
.indicator(.activity)
} }
} else {
WebImage(url: playlist.thumbnailURL)
.resizable()
.placeholder {
Rectangle().fill(Color("PlaceholderColor"))
}
.indicator(.activity)
.frame(width: 165, height: 88)
.clipShape(RoundedRectangle(cornerRadius: 10))
} }
.frame(width: 165, height: 88)
.clipShape(RoundedRectangle(cornerRadius: 10))
Group { Group {
DetailBadge(text: playlist.title, style: .prominent) DetailBadge(text: playlist.title, style: .prominent)
.lineLimit(2) .lineLimit(2)