diff --git a/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift b/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift index 952867d6e0..ee97abc965 100644 --- a/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift +++ b/Tusker/Screens/Gallery/StatusAttachmentsGalleryDataSource.swift @@ -30,7 +30,7 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource { switch attachment.kind { case .image: if let view = attachmentView(for: attachment), - let image = view.image { + let image = view.attachmentImage { return ImageGalleryContentViewController( url: attachment.url, caption: attachment.description, diff --git a/Tusker/Views/Attachments/AttachmentView.swift b/Tusker/Views/Attachments/AttachmentView.swift index f84a1383a3..b28cf84336 100644 --- a/Tusker/Views/Attachments/AttachmentView.swift +++ b/Tusker/Views/Attachments/AttachmentView.swift @@ -32,6 +32,16 @@ class AttachmentView: GIFImageView { private var loadAttachmentTask: Task? private var source: Source? + var attachmentImage: UIImage? { + switch source { + case .image(_, _, let image): + return image + case .gifData(_, _, let image): + return image + case nil: + return nil + } + } var originalData: Data? { switch source { case .image(_, let data, _):