Ensure constant bubble sizes for visual media.

This commit is contained in:
Matthew Chen 2019-03-15 09:47:04 -04:00
parent c180d20dcd
commit 14e7274c3d
2 changed files with 7 additions and 3 deletions

View File

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

View File

@ -704,10 +704,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
: nil);
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
attachmentStream:nil
caption:caption
mediaSize:CGSizeZero]];
mediaSize:mediaSize]];
continue;
}
TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;