mirror of
https://github.com/yattee/yattee.git
synced 2024-11-12 17:18:22 +00:00
Load images with low priority
This commit is contained in:
parent
402d1a2f79
commit
4d94126abd
@ -31,7 +31,7 @@ struct ChapterView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
||||||
WebImage(url: chapter.image)
|
WebImage(url: chapter.image, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
|
@ -103,7 +103,7 @@ struct CommentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var authorAvatar: some View {
|
private var authorAvatar: some View {
|
||||||
WebImage(url: URL(string: comment.authorAvatarURL)!)
|
WebImage(url: URL(string: comment.authorAvatarURL)!, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
@ -221,7 +221,7 @@ struct PlayerControls: View {
|
|||||||
let video = item.video,
|
let video = item.video,
|
||||||
let url = thumbnails.best(video)
|
let url = thumbnails.best(video)
|
||||||
{
|
{
|
||||||
WebImage(url: url)
|
WebImage(url: url, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
@ -95,12 +95,8 @@ struct VideoBanner: View {
|
|||||||
Group {
|
Group {
|
||||||
if let video {
|
if let video {
|
||||||
if let thumbnail = video.thumbnailURL(quality: .medium) {
|
if let thumbnail = video.thumbnailURL(quality: .medium) {
|
||||||
WebImage(url: thumbnail)
|
WebImage(url: thumbnail, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
|
||||||
ProgressView()
|
|
||||||
}
|
|
||||||
.indicator(.activity)
|
|
||||||
} else if video.localStreamIsFile {
|
} else if video.localStreamIsFile {
|
||||||
Image(systemName: "folder")
|
Image(systemName: "folder")
|
||||||
} else if video.localStreamIsRemoteURL {
|
} else if video.localStreamIsRemoteURL {
|
||||||
|
@ -422,7 +422,7 @@ struct VideoCell: View {
|
|||||||
Group {
|
Group {
|
||||||
let url = thumbnails.best(video)
|
let url = thumbnails.best(video)
|
||||||
|
|
||||||
WebImage(url: url)
|
WebImage(url: url, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
|
@ -38,7 +38,7 @@ struct ChannelCell: View {
|
|||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
WebImage(url: channel.thumbnailURL)
|
WebImage(url: channel.thumbnailURL, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
@ -37,7 +37,7 @@ struct ChannelPlaylistCell: View {
|
|||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
WebImage(url: playlist.thumbnailURL)
|
WebImage(url: playlist.thumbnailURL, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
@ -274,7 +274,7 @@ struct ControlsBar: View {
|
|||||||
private var authorAvatar: some View {
|
private var authorAvatar: some View {
|
||||||
Group {
|
Group {
|
||||||
if let url = model.currentItem?.video?.channel.thumbnailURL {
|
if let url = model.currentItem?.video?.channel.thumbnailURL {
|
||||||
WebImage(url: url)
|
WebImage(url: url, options: [.lowPriority])
|
||||||
.resizable()
|
.resizable()
|
||||||
.placeholder {
|
.placeholder {
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
Loading…
Reference in New Issue
Block a user