Use WebImage fix

This commit is contained in:
Arkadiusz Fal
2022-09-11 21:33:08 +02:00
parent b94dc08b68
commit 1c926f276b
9 changed files with 97 additions and 167 deletions

View File

@@ -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 {

View File

@@ -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)
}
}