From 608cd2781f068e249c3a5c120929099b84cf171b Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 2 Nov 2017 10:33:33 -0400 Subject: [PATCH 1/3] Constrain the max text cell height to the height of the screen. // FREEBIE --- .../ConversationView/Cells/OWSMessageCell.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index f09b1038a..6766bb2c7 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -848,6 +848,17 @@ NS_ASSUME_NONNULL_BEGIN [self cropViewToBubbbleShape:self.customView]; } +- (CGFloat)maxCellHeight +{ + static CGFloat value = 0.f; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + CGSize screenSize = [UIScreen mainScreen].bounds.size; + value = MAX(screenSize.width, screenSize.height); + }); + return value; +} + - (CGSize)cellSizeForViewWidth:(int)viewWidth contentWidth:(int)contentWidth { OWSAssert(self.viewItem); @@ -869,6 +880,8 @@ NS_ASSUME_NONNULL_BEGIN // Honor dynamic type in the message bodies. self.textView.font = [self textMessageFont]; CGSize textSize = [self.textView sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]; + // Constrain the max text cell height to the height of the screen. + textSize.height = MIN(textSize.height, self.maxCellHeight); CGFloat tapForMoreHeight = (self.displayableText.isTextTruncated ? [self tapForMoreHeight] : 0.f); cellSize = CGSizeMake((CGFloat)ceil(textSize.width + leftMargin + rightMargin), (CGFloat)ceil(textSize.height + textVMargin * 2 + tapForMoreHeight)); From ea0b6065e3553f181b5d5f0fcf126bf7b0bd7d76 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 3 Nov 2017 09:18:10 -0400 Subject: [PATCH 2/3] Revert "Constrain the max text cell height to the height of the screen." This reverts commit b9583a3c85a3b27f65b653a1d851c7c966fdc83d. // FREEBIE --- .../ConversationView/Cells/OWSMessageCell.m | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 6766bb2c7..f09b1038a 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -848,17 +848,6 @@ NS_ASSUME_NONNULL_BEGIN [self cropViewToBubbbleShape:self.customView]; } -- (CGFloat)maxCellHeight -{ - static CGFloat value = 0.f; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - CGSize screenSize = [UIScreen mainScreen].bounds.size; - value = MAX(screenSize.width, screenSize.height); - }); - return value; -} - - (CGSize)cellSizeForViewWidth:(int)viewWidth contentWidth:(int)contentWidth { OWSAssert(self.viewItem); @@ -880,8 +869,6 @@ NS_ASSUME_NONNULL_BEGIN // Honor dynamic type in the message bodies. self.textView.font = [self textMessageFont]; CGSize textSize = [self.textView sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]; - // Constrain the max text cell height to the height of the screen. - textSize.height = MIN(textSize.height, self.maxCellHeight); CGFloat tapForMoreHeight = (self.displayableText.isTextTruncated ? [self tapForMoreHeight] : 0.f); cellSize = CGSizeMake((CGFloat)ceil(textSize.width + leftMargin + rightMargin), (CGFloat)ceil(textSize.height + textVMargin * 2 + tapForMoreHeight)); From a5c4140a12c9ae043dd7a725c3753ee1a8bee1ca Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 3 Nov 2017 09:21:38 -0400 Subject: [PATCH 3/3] Reduce max text message bubble size. // FREEBIE --- .../src/ViewControllers/ConversationView/ConversationViewItem.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index a3f54ef18..d17d36f45 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -304,7 +304,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) NSString *text = textBlock(); // Only show up to N characters of text. - const NSUInteger kMaxTextDisplayLength = 1024; + const NSUInteger kMaxTextDisplayLength = 512; NSString *_Nullable fullText = [DisplayableText displayableText:text]; BOOL isTextTruncated = NO; if (!fullText) {