diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index a85bf7cc4..e2ed14ca6 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -404,9 +404,9 @@ NS_ASSUME_NONNULL_BEGIN [self.viewConstraints addObjectsFromArray:@[ [bodyTextView autoPinLeadingToSuperviewMarginWithInset:textInsets.leading], [bodyTextView autoPinTrailingToSuperviewMarginWithInset:textInsets.trailing], + [bodyTextView autoSetDimension:ALDimensionWidth toSize:bodyTextContentSize.width], + [bodyTextView autoSetDimension:ALDimensionHeight toSize:bodyTextContentSize.height], ]]; - [self.viewConstraints - addObject:[bodyTextView autoSetDimension:ALDimensionHeight toSize:bodyTextContentSize.height]]; if (lastSubview) { [self.viewConstraints addObject:[bodyTextView autoPinEdge:ALEdgeTop diff --git a/Signal/src/ViewControllers/ConversationView/ConversationLayoutInfo.swift b/Signal/src/ViewControllers/ConversationView/ConversationLayoutInfo.swift index 5e398ae02..e77b8b15a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationLayoutInfo.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationLayoutInfo.swift @@ -114,7 +114,7 @@ public class ConversationLayoutInfo: NSObject { fullWidthContentWidth = viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing) - maxMessageWidth = floor(contentWidth * 0.8) + maxMessageWidth = floor(contentWidth * 0.9) // TODO: Should this be different? maxFooterWidth = maxMessageWidth - 10 diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 2cb4e15eb..a89f38ebb 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -261,12 +261,18 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) return measurementCell; } -- (CGFloat)vSpacingWithPreviousLayoutItem:(id)lastLayoutItem +- (CGFloat)vSpacingWithPreviousLayoutItem:(ConversationViewItem *)previousLayoutItem { - OWSAssert(lastLayoutItem); + OWSAssert(lastItem); + + if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator + || previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator) { + // The unread indicator has its own v-margins. + return 0.f; + } // TODO: - return 0.f; + return 4.f; } - (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index 5ecc93616..9774ea526 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -40,8 +40,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele var attachmentStream: TSAttachmentStream? var messageBody: String? - var conversationLayoutInfo: ConversationLayoutInfo - private var contactShareViewHelper: ContactShareViewHelper // MARK: Initializers @@ -59,7 +57,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele self.mode = mode self.uiDatabaseConnection = OWSPrimaryStorage.shared().newDatabaseConnection() self.contactShareViewHelper = ContactShareViewHelper(contactsManager: contactsManager) - self.conversationLayoutInfo = ConversationLayoutInfo(thread: thread) super.init(nibName: nil, bundle: nil) @@ -345,7 +342,9 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele self.messageBubbleView = messageBubbleView messageBubbleView.viewItem = viewItem messageBubbleView.cellMediaCache = NSCache() - messageBubbleView.layoutInfo = self.conversationLayoutInfo + let conversationLayoutInfo = ConversationLayoutInfo(thread: thread) + conversationLayoutInfo.viewWidth = self.view.width() + messageBubbleView.layoutInfo = conversationLayoutInfo messageBubbleView.configureViews() messageBubbleView.loadContent()