Fix race between loading/animation when presenting gallery from attachment more view

This commit is contained in:
Shadowfacts 2024-04-02 21:21:19 -04:00
parent 490d48c635
commit ae7101bb30
1 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,21 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource {
// TODO: if automatically play gifs is off, this will start the source view playing too // TODO: if automatically play gifs is off, this will start the source view playing too
gifController: view.gifController 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 { } else {
return LoadingGalleryContentViewController { return LoadingGalleryContentViewController {
let (data, image) = await ImageCache.attachments.get(attachment.url, loadOriginal: true) let (data, image) = await ImageCache.attachments.get(attachment.url, loadOriginal: true)