Ensure constant bubble sizes for visual media.

pull/2/head
Matthew Chen 6 years ago
parent c180d20dcd
commit 14e7274c3d

@ -1027,8 +1027,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
if (self.viewItem.mediaAlbumItems.count == 1) { if (self.viewItem.mediaAlbumItems.count == 1) {
// Honor the content aspect ratio for single media. // Honor the content aspect ratio for single media.
ConversationMediaAlbumItem *mediaAlbumItem = self.viewItem.mediaAlbumItems.firstObject; ConversationMediaAlbumItem *mediaAlbumItem = self.viewItem.mediaAlbumItems.firstObject;
if (mediaAlbumItem.attachmentStream && mediaAlbumItem.mediaSize.width > 0 if (mediaAlbumItem.mediaSize.width > 0 && mediaAlbumItem.mediaSize.height > 0) {
&& mediaAlbumItem.mediaSize.height > 0) {
CGSize mediaSize = mediaAlbumItem.mediaSize; CGSize mediaSize = mediaAlbumItem.mediaSize;
CGFloat contentAspectRatio = mediaSize.width / mediaSize.height; CGFloat contentAspectRatio = mediaSize.width / mediaSize.height;
// Clamp the aspect ratio so that very thin/wide content is presented // Clamp the aspect ratio so that very thin/wide content is presented

@ -704,10 +704,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
: nil); : nil);
if (![attachment isKindOfClass:[TSAttachmentStream class]]) { if (![attachment isKindOfClass:[TSAttachmentStream class]]) {
TSAttachmentPointer *attachmentPointer = (TSAttachmentPointer *)attachment;
CGSize mediaSize = CGSizeZero;
if (attachmentPointer.mediaSize.width > 0 && attachmentPointer.mediaSize.height > 0) {
mediaSize = attachmentPointer.mediaSize;
}
[mediaAlbumItems addObject:[[ConversationMediaAlbumItem alloc] initWithAttachment:attachment [mediaAlbumItems addObject:[[ConversationMediaAlbumItem alloc] initWithAttachment:attachment
attachmentStream:nil attachmentStream:nil
caption:caption caption:caption
mediaSize:CGSizeZero]]; mediaSize:mediaSize]];
continue; continue;
} }
TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment; TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;

Loading…
Cancel
Save