From 26c8c4e1fac41025794272a37db1a8c409635a75 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 27 Sep 2017 22:25:50 -0400 Subject: [PATCH] Rework message metadata view. // FREEBIE --- .../MessageMetadataViewController.swift | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/MessageMetadataViewController.swift b/Signal/src/ViewControllers/MessageMetadataViewController.swift index eed5b07a4..890e93fcf 100644 --- a/Signal/src/ViewControllers/MessageMetadataViewController.swift +++ b/Signal/src/ViewControllers/MessageMetadataViewController.swift @@ -276,22 +276,40 @@ class MessageMetadataViewController: OWSViewController { bodyLabel.textColor = isIncoming ? UIColor.black : UIColor.white bodyLabel.font = UIFont.ows_regularFont(withSize:16) bodyLabel.text = messageBody + // Only show the first N lines. bodyLabel.numberOfLines = 10 bodyLabel.lineBreakMode = .byWordWrapping let bubbleView = UIView() - bubbleView.backgroundColor = isIncoming ? UIColor.gray : UIColor.ows_materialBlue() + bubbleView.backgroundColor = isIncoming ? UIColor.jsq_messageBubbleLightGray() : UIColor.ows_materialBlue() bubbleView.layer.cornerRadius = 10 bubbleView.addSubview(bodyLabel) bodyLabel.autoPinLeadingToSuperView(withMargin:10) bodyLabel.autoPinTrailingToSuperView(withMargin:10) bodyLabel.autoPinHeightToSuperview(withMargin:10) + let bubbleSpacer = UIView() + let row = UIView() row.addSubview(bubbleView) - bubbleView.autoPinLeadingToSuperView(withMargin:10) - bubbleView.autoPinTrailingToSuperView(withMargin:10) + row.addSubview(bubbleSpacer) + bubbleView.autoPinHeightToSuperview() + bubbleView.setContentHuggingHorizontalHigh() + bubbleView.setCompressionResistanceHigh() + bubbleSpacer.autoPinHeightToSuperview() + bubbleSpacer.setContentHuggingLow() + + if isIncoming { + bubbleView.autoPinLeadingToSuperView(withMargin:10) + bubbleSpacer.autoPinLeading(toTrailingOf:bubbleView) + bubbleSpacer.autoPinTrailingToSuperView(withMargin:10) + } else { + bubbleSpacer.autoPinLeadingToSuperView(withMargin:10) + bubbleView.autoPinLeading(toTrailingOf:bubbleSpacer) + bubbleView.autoPinTrailingToSuperView(withMargin:10) + } + rows.append(row) } else { // Neither attachment nor body.