mirror of
git://jb55.com/damus
synced 2024-09-30 08:50:42 +00:00
preloader: only preload non-animated images to test animation bug fix
This commit is contained in:
parent
d091543448
commit
12428d01ad
@ -370,6 +370,14 @@ func preload_image(url: URL) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func is_animated_image(url: URL) -> Bool {
|
||||||
|
guard let ext = url.pathComponents.last?.split(separator: ".").last?.lowercased() else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return ext == "gif"
|
||||||
|
}
|
||||||
|
|
||||||
func preload_event(plan: PreloadPlan, state: DamusState) async {
|
func preload_event(plan: PreloadPlan, state: DamusState) async {
|
||||||
var artifacts: NoteArtifacts? = plan.data.artifacts.artifacts
|
var artifacts: NoteArtifacts? = plan.data.artifacts.artifacts
|
||||||
let settings = state.settings
|
let settings = state.settings
|
||||||
@ -387,12 +395,16 @@ func preload_event(plan: PreloadPlan, state: DamusState) async {
|
|||||||
plan.data.artifacts_model.state = .loaded(arts)
|
plan.data.artifacts_model.state = .loaded(arts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// jb55: image preloading might be breaking gifs? some kind of disk race condition perhaps?
|
|
||||||
/*
|
|
||||||
for url in arts.images {
|
for url in arts.images {
|
||||||
|
guard !is_animated_image(url: url) else {
|
||||||
|
// jb55: I have a theory that animated images are not working with the preloader due
|
||||||
|
// to some disk-cache write race condition. normal images need not apply
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
preload_image(url: url)
|
preload_image(url: url)
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if plan.load_preview {
|
if plan.load_preview {
|
||||||
|
Loading…
Reference in New Issue
Block a user