diff --git a/Shared/Player/ChapterView.swift b/Shared/Player/ChapterView.swift index f8225bf2..4bbde4db 100644 --- a/Shared/Player/ChapterView.swift +++ b/Shared/Player/ChapterView.swift @@ -32,28 +32,30 @@ struct ChapterView: View { } @ViewBuilder func smallImage(_ chapter: Chapter) -> some View { - if #available(iOS 15, macOS 12, *) { - CachedAsyncImage(url: chapter.image) { image in - image - .resizable() - } placeholder: { - Rectangle().foregroundColor(Color("PlaceholderColor")) - } - } else { - WebImage(url: chapter.image) - .resizable() - .placeholder { - ProgressView() + Group { + if #available(iOS 15, macOS 12, *) { + CachedAsyncImage(url: chapter.image) { 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 + } 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 } private var thumbnailWidth: Double { diff --git a/Shared/Videos/VideoBanner.swift b/Shared/Videos/VideoBanner.swift index 8c175fec..13e62e6c 100644 --- a/Shared/Videos/VideoBanner.swift +++ b/Shared/Videos/VideoBanner.swift @@ -73,35 +73,30 @@ struct VideoBanner: View { @ViewBuilder private var smallThumbnail: some View { let url = video?.thumbnailURL(quality: .medium) - if #available(iOS 15, macOS 12, *) { - CachedAsyncImage(url: url) { image in - image - .resizable() - } placeholder: { - Rectangle().foregroundColor(Color("PlaceholderColor")) - } - #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() + Group { + if #available(iOS 15, macOS 12, *) { + CachedAsyncImage(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 + } 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 { diff --git a/Shared/Videos/VideoCell.swift b/Shared/Videos/VideoCell.swift index 501b5b17..0e0383bb 100644 --- a/Shared/Videos/VideoCell.swift +++ b/Shared/Videos/VideoCell.swift @@ -429,9 +429,6 @@ struct VideoCell: View { } placeholder: { Rectangle().foregroundColor(Color("PlaceholderColor")) } - #if os(tvOS) - .frame(minHeight: 320) - #endif } else { WebImage(url: url) .resizable() @@ -443,12 +440,11 @@ struct VideoCell: View { 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()) } diff --git a/Shared/Views/ChannelCell.swift b/Shared/Views/ChannelCell.swift index cf526632..6c5b8fb3 100644 --- a/Shared/Views/ChannelCell.swift +++ b/Shared/Views/ChannelCell.swift @@ -38,23 +38,26 @@ struct ChannelCell: View { .opacity(0.6) } .foregroundColor(.secondary) - if #available(iOS 15, macOS 12, *) { - CachedAsyncImage(url: channel.thumbnailURL) { image in - image - .resizable() - } placeholder: { - Rectangle().foregroundColor(Color("PlaceholderColor")) - } - } else { - WebImage(url: channel.thumbnailURL) - .resizable() - .placeholder { - Rectangle().fill(Color("PlaceholderColor")) + + Group { + if #available(iOS 15, macOS 12, *) { + CachedAsyncImage(url: channel.thumbnailURL) { image in + image + .resizable() + } placeholder: { + Rectangle().foregroundColor(Color("PlaceholderColor")) } - .indicator(.activity) - .frame(width: 88, height: 88) - .clipShape(Circle()) + } else { + WebImage(url: channel.thumbnailURL) + .resizable() + .placeholder { + Rectangle().fill(Color("PlaceholderColor")) + } + .indicator(.activity) + } } + .frame(width: 88, height: 88) + .clipShape(Circle()) DetailBadge(text: channel.name, style: .prominent) diff --git a/Shared/Views/ChannelPlaylistCell.swift b/Shared/Views/ChannelPlaylistCell.swift index 9e7bc0a5..c2399f7e 100644 --- a/Shared/Views/ChannelPlaylistCell.swift +++ b/Shared/Views/ChannelPlaylistCell.swift @@ -38,23 +38,26 @@ struct ChannelPlaylistCell: View { } .foregroundColor(.secondary) - if #available(iOS 15, macOS 12, *) { - CachedAsyncImage(url: playlist.thumbnailURL) { image in - image - .resizable() - } placeholder: { - Rectangle().foregroundColor(Color("PlaceholderColor")) - } - } else { - WebImage(url: playlist.thumbnailURL) - .resizable() - .placeholder { - Rectangle().fill(Color("PlaceholderColor")) + Group { + if #available(iOS 15, macOS 12, *) { + CachedAsyncImage(url: playlist.thumbnailURL) { image in + image + .resizable() + } placeholder: { + Rectangle().foregroundColor(Color("PlaceholderColor")) } - .indicator(.activity) - .frame(width: 165, height: 88) - .clipShape(RoundedRectangle(cornerRadius: 10)) + } else { + WebImage(url: playlist.thumbnailURL) + .resizable() + .placeholder { + Rectangle().fill(Color("PlaceholderColor")) + } + .indicator(.activity) + } } + .frame(width: 165, height: 88) + .clipShape(RoundedRectangle(cornerRadius: 10)) + Group { DetailBadge(text: playlist.title, style: .prominent) .lineLimit(2)