diff --git a/Signal/src/ViewControllers/MediaDetailViewController.m b/Signal/src/ViewControllers/MediaDetailViewController.m index ef620e503..9ea5d1104 100644 --- a/Signal/src/ViewControllers/MediaDetailViewController.m +++ b/Signal/src/ViewControllers/MediaDetailViewController.m @@ -79,6 +79,7 @@ NS_ASSUME_NONNULL_BEGIN thumbnailImageLargeWithSuccess:^(UIImage *image) { weakSelf.image = image; [weakSelf createContents]; + [weakSelf updateMinZoomScale]; } failure:^{ DDLogWarn(@"Could not load media."); @@ -127,6 +128,13 @@ NS_ASSUME_NONNULL_BEGIN - (void)updateMinZoomScale { + if (!self.image) { + self.scrollView.minimumZoomScale = 1.f; + self.scrollView.maximumZoomScale = 1.f; + self.scrollView.zoomScale = 1.f; + return; + } + CGSize viewSize = self.scrollView.bounds.size; UIImage *image = self.image; OWSAssert(image); diff --git a/SignalServiceKit/src/Messages/Attachments/OWSThumbnailService.swift b/SignalServiceKit/src/Messages/Attachments/OWSThumbnailService.swift index 9a2ad6910..680492211 100644 --- a/SignalServiceKit/src/Messages/Attachments/OWSThumbnailService.swift +++ b/SignalServiceKit/src/Messages/Attachments/OWSThumbnailService.swift @@ -146,6 +146,9 @@ private struct OWSThumbnailRequest { } return OWSLoadedThumbnail(image: image, filePath: thumbnailPath) } + + Logger.verbose("Creating thumbnail of size: \(thumbnailRequest.thumbnailDimensionPoints)") + let thumbnailDirPath = (thumbnailPath as NSString).deletingLastPathComponent guard OWSFileSystem.ensureDirectoryExists(thumbnailDirPath) else { throw OWSThumbnailError.failure(description: "Could not create attachment's thumbnail directory.") diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index a8b7193e5..813312992 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m @@ -20,7 +20,7 @@ const NSUInteger ThumbnailDimensionPointsLarge() { CGSize screenSizePoints = UIScreen.mainScreen.bounds.size; const CGFloat kMinZoomFactor = 2.f; - return MAX(screenSizePoints.width * kMinZoomFactor, screenSizePoints.height * kMinZoomFactor); + return MAX(screenSizePoints.width, screenSizePoints.height) * kMinZoomFactor; } typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail);