Fix blurhash image being used as gallery content

This commit is contained in:
Shadowfacts 2024-03-29 22:18:24 -04:00
parent fe00015248
commit eafb506d64
2 changed files with 11 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class StatusAttachmentsGalleryDataSource: GalleryDataSource {
switch attachment.kind { switch attachment.kind {
case .image: case .image:
if let view = attachmentView(for: attachment), if let view = attachmentView(for: attachment),
let image = view.image { let image = view.attachmentImage {
return ImageGalleryContentViewController( return ImageGalleryContentViewController(
url: attachment.url, url: attachment.url,
caption: attachment.description, caption: attachment.description,

View File

@ -32,6 +32,16 @@ class AttachmentView: GIFImageView {
private var loadAttachmentTask: Task<Void, Never>? private var loadAttachmentTask: Task<Void, Never>?
private var source: Source? 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? { var originalData: Data? {
switch source { switch source {
case .image(_, let data, _): case .image(_, let data, _):