Update media gallery view on the main thread

This commit is contained in:
Harry 2024-04-22 09:57:31 -07:00 committed by GitHub
parent c3da50e5d5
commit eaf36878a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,11 +110,11 @@ class MediaGalleryItem: Equatable, Hashable, MediaGallerySectionItem {
var attachmentId: MediaGalleryResourceId { attachmentStream.reference.mediaGalleryResourceId }
typealias AsyncThumbnailBlock = (UIImage) -> Void
typealias AsyncThumbnailBlock = @MainActor (UIImage) -> Void
func thumbnailImage(async: @escaping AsyncThumbnailBlock) -> UIImage? {
Task { [attachmentStream] in
if let image = await attachmentStream.attachmentStream.thumbnailImage(quality: .small) {
async(image)
await async(image)
}
}
return nil