Merge branch 'charlesmchen/tweakMessages3'

pull/1/head
Matthew Chen 7 years ago
commit 484be57dcc

@ -609,12 +609,12 @@ NS_ASSUME_NONNULL_BEGIN
- (CGFloat)bodyMediaQuotedReplyVSpacing - (CGFloat)bodyMediaQuotedReplyVSpacing
{ {
return 8.f; return 6.f;
} }
- (CGFloat)quotedReplyTopMargin - (CGFloat)quotedReplyTopMargin
{ {
return 7.f; return 6.f;
} }
#pragma mark - Load / Unload #pragma mark - Load / Unload
@ -1026,7 +1026,6 @@ NS_ASSUME_NONNULL_BEGIN
} }
CGFloat hMargins = self.conversationStyle.textInsetHorizontal * 2; CGFloat hMargins = self.conversationStyle.textInsetHorizontal * 2;
const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins); const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins);
[self configureBodyTextView]; [self configureBodyTextView];
@ -1042,6 +1041,10 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.conversationStyle.maxMessageWidth > 0); OWSAssert(self.conversationStyle.maxMessageWidth > 0);
CGFloat maxMessageWidth = self.conversationStyle.maxMessageWidth; CGFloat maxMessageWidth = self.conversationStyle.maxMessageWidth;
if (!self.hasFullWidthMediaView) {
CGFloat hMargins = self.conversationStyle.textInsetHorizontal * 2;
maxMessageWidth -= hMargins;
}
CGSize result = CGSizeZero; CGSize result = CGSizeZero;
switch (self.cellType) { switch (self.cellType) {
@ -1150,7 +1153,7 @@ NS_ASSUME_NONNULL_BEGIN
const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins); const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins);
[self configureSenderNameLabel]; [self configureSenderNameLabel];
CGSize result = CGSizeCeil([self.senderNameLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]); CGSize result = CGSizeCeil([self.senderNameLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]);
result.width = MIN(result.width, maxTextWidth);
return [NSValue valueWithCGSize:result]; return [NSValue valueWithCGSize:result];
} }
@ -1230,6 +1233,9 @@ NS_ASSUME_NONNULL_BEGIN
cellSize = CGSizeCeil(cellSize); cellSize = CGSizeCeil(cellSize);
OWSAssert(cellSize.width <= self.conversationStyle.maxMessageWidth);
cellSize.width = MIN(cellSize.width, self.conversationStyle.maxMessageWidth);
return cellSize; return cellSize;
} }

@ -131,6 +131,11 @@ NS_ASSUME_NONNULL_BEGIN
return 8.f; return 8.f;
} }
- (CGFloat)vSpacing
{
return 2.f;
}
- (CGFloat)stripeThickness - (CGFloat)stripeThickness
{ {
return 4.f; return 4.f;
@ -204,6 +209,7 @@ NS_ASSUME_NONNULL_BEGIN
vStackView.axis = UILayoutConstraintAxisVertical; vStackView.axis = UILayoutConstraintAxisVertical;
vStackView.layoutMargins = UIEdgeInsetsMake(self.textVMargin, 0, self.textVMargin, 0); vStackView.layoutMargins = UIEdgeInsetsMake(self.textVMargin, 0, self.textVMargin, 0);
vStackView.layoutMarginsRelativeArrangement = YES; vStackView.layoutMarginsRelativeArrangement = YES;
vStackView.spacing = self.vSpacing;
[hStackView addArrangedSubview:vStackView]; [hStackView addArrangedSubview:vStackView];
UILabel *quotedAuthorLabel = [self configureQuotedAuthorLabel]; UILabel *quotedAuthorLabel = [self configureQuotedAuthorLabel];
@ -469,7 +475,7 @@ NS_ASSUME_NONNULL_BEGIN
// Quoted Author // Quoted Author
CGFloat textWidth = 0.f; CGFloat textWidth = 0.f;
CGFloat maxTextWidth = maxWidth - result.width; CGFloat maxTextWidth = maxWidth - result.width;
CGFloat textHeight = self.textVMargin * 2 + self.quotedAuthorHeight; CGFloat textHeight = self.textVMargin * 2 + self.quotedAuthorHeight + self.vSpacing;
{ {
UILabel *quotedAuthorLabel = [self configureQuotedAuthorLabel]; UILabel *quotedAuthorLabel = [self configureQuotedAuthorLabel];

@ -293,8 +293,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return 2.f; return 2.f;
} }
// TODO: return 12.f;
return 10.f;
} }
- (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView - (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView

Loading…
Cancel
Save