From ee6c080af8ab504f9862a5d278e89bcae6309bec Mon Sep 17 00:00:00 2001 From: William Casarin Date: Tue, 2 May 2023 06:44:06 -0700 Subject: [PATCH] Fix blurhash appearing behind loaded images when swiping on carousel Changelog-Fixed: Fixed blurhash appearing behind loaded images when swiping on carousel --- damus/Components/ImageCarousel.swift | 4 ++++ damus/Util/EventCache.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/damus/Components/ImageCarousel.swift b/damus/Components/ImageCarousel.swift index 72de487c..88d587d7 100644 --- a/damus/Components/ImageCarousel.swift +++ b/damus/Components/ImageCarousel.swift @@ -131,6 +131,10 @@ struct ImageCarousel: View { } .imageFill(for: geo.size, max: maxHeight, fill: fillHeight) { fill in state.previews.cache_image_meta(evid: evid, image_fill: fill) + // blur hash can be discarded when we have the url + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + state.events.lookup_img_metadata(url: url)?.state = .not_needed + } image_fill = fill } .background { diff --git a/damus/Util/EventCache.swift b/damus/Util/EventCache.swift index b7acc45a..1b53326e 100644 --- a/damus/Util/EventCache.swift +++ b/damus/Util/EventCache.swift @@ -25,6 +25,7 @@ enum ImageMetaProcessState { case processing case failed case processed(UIImage) + case not_needed var img: UIImage? { switch self {