From d40f74dd0bcd8e5802bb9d7a19ba89309442d808 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 25 Jun 2018 12:43:25 -0400 Subject: [PATCH] Respond to CR. --- .../ConversationView/Cells/OWSContactOffersCell.m | 2 -- .../ConversationView/Cells/OWSMessageBubbleView.m | 2 +- .../ConversationView/Cells/OWSSystemMessageCell.m | 1 - .../ConversationView/ConversationViewItem.m | 2 +- .../ConversationView/ConversationViewLayout.h | 2 +- .../ConversationView/ConversationViewLayout.m | 8 ++++---- .../src/ViewControllers/MessageDetailViewController.swift | 2 ++ 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m index 9fe6d53f1..f74fdf514 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m @@ -74,7 +74,6 @@ NS_ASSUME_NONNULL_BEGIN buttonStackView.spacing = self.vSpacing; // Ensure all of the buttons have the same width. buttonStackView.alignment = UIStackViewAlignmentFill; - buttonStackView.layoutMargins = UIEdgeInsetsZero; self.stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.titleLabel, @@ -83,7 +82,6 @@ NS_ASSUME_NONNULL_BEGIN self.stackView.axis = UILayoutConstraintAxisVertical; self.stackView.spacing = self.vSpacing; self.stackView.alignment = UIStackViewAlignmentCenter; - self.stackView.layoutMargins = UIEdgeInsetsZero; [self.contentView addSubview:self.stackView]; } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 008ca2cc6..01946162d 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -925,7 +925,7 @@ NS_ASSUME_NONNULL_BEGIN mediaHeight *= factor; } - return CGSizeRound(CGSizeMake(mediaWidth, mediaHeight)); + result = CGSizeRound(CGSizeMake(mediaWidth, mediaHeight)); break; } case OWSMessageCellType_Audio: diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m index b24ffb6e2..bc3d411d6 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m @@ -66,7 +66,6 @@ NS_ASSUME_NONNULL_BEGIN self.stackView.axis = UILayoutConstraintAxisHorizontal; self.stackView.spacing = self.hSpacing; self.stackView.alignment = UIStackViewAlignmentCenter; - self.stackView.layoutMargins = UIEdgeInsetsZero; [self.contentView addSubview:self.stackView]; UITapGestureRecognizer *tap = diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index b080befdd..9a1cb891f 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -260,7 +260,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) return measurementCell; } -- (CGFloat)vSpacingWithLastLayoutItem:(id)lastLayoutItem +- (CGFloat)vSpacingWithPreviousLayoutItem:(id)lastLayoutItem { OWSAssert(lastLayoutItem); diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.h b/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.h index cbebd870e..e72c9513d 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.h +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.h @@ -21,7 +21,7 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) { - (ConversationViewLayoutAlignment)layoutAlignment; -- (CGFloat)vSpacingWithLastLayoutItem:(id)lastLayoutItem; +- (CGFloat)vSpacingWithPreviousLayoutItem:(id)lastLayoutItem; @end diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.m b/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.m index bde70a820..61097b3bc 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.m @@ -102,10 +102,10 @@ NS_ASSUME_NONNULL_BEGIN CGFloat contentBottom = y; NSInteger row = 0; - id _Nullable lastLayoutItem = nil; + id _Nullable previousLayoutItem = nil; for (id layoutItem in layoutItems) { - if (lastLayoutItem) { - y += [layoutItem vSpacingWithLastLayoutItem:lastLayoutItem]; + if (previousLayoutItem) { + y += [layoutItem vSpacingWithPreviousLayoutItem:previousLayoutItem]; } CGSize layoutSize = CGSizeCeil([layoutItem cellSize]); @@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN contentBottom = itemFrame.origin.y + itemFrame.size.height; y = contentBottom; row++; - lastLayoutItem = layoutItem; + previousLayoutItem = layoutItem; } contentBottom += self.layoutInfo.contentMarginBottom; diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index 04b7039a1..ed36a186a 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -74,6 +74,8 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele self.uiDatabaseConnection.beginLongLivedReadTransaction() updateDBConnectionAndMessageToLatest() + self.conversationLayoutInfo.viewWidth = view.width() + self.navigationItem.title = NSLocalizedString("MESSAGE_METADATA_VIEW_TITLE", comment: "Title for the 'message metadata' view.")