From ae7101bb3078e5299e953667468d85dd5794c083 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 2 Apr 2024 21:21:19 -0400 Subject: [PATCH] Fix race between loading/animation when presenting gallery from attachment more view --- .../StatusAttachmentsGalleryDataSource.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift b/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift index ee97abc9..e4c495a1 100644 --- a/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift +++ b/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift @@ -39,6 +39,21 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource { // TODO: if automatically play gifs is off, this will start the source view playing too gifController: view.gifController ) + } else if let entry = ImageCache.attachments.get(attachment.url, loadOriginal: true) { + let gifController: GIFController? = + if attachment.url.pathExtension == "gif", + let data = entry.data { + GIFController(gifData: data) + } else { + nil + } + return ImageGalleryContentViewController( + url: attachment.url, + caption: attachment.description, + originalData: entry.data, + image: entry.image, + gifController: gifController + ) } else { return LoadingGalleryContentViewController { let (data, image) = await ImageCache.attachments.get(attachment.url, loadOriginal: true)