From 53101a3fc9cdda825fe19f29ef26e867c312e481 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 28 Nov 2018 16:11:40 -0700 Subject: [PATCH] Fix missing album thumbnails --- Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift b/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift index 7d183aa0e..d0848647d 100644 --- a/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift +++ b/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift @@ -47,10 +47,15 @@ class PhotoPickerAssetItem: PhotoGridItem { } func asyncThumbnail(completion: @escaping (UIImage?) -> Void) -> UIImage? { + var syncImageResult: UIImage? + + // Surprisingly, iOS will opportunistically run the completion block sync if the image is + // already available photoCollectionContents.requestThumbnail(for: self.asset, thumbnailSize: photoMediaSize.thumbnailSize) { image, _ in + syncImageResult = image completion(image) } - return nil + return syncImageResult } }