From 18417edbde9049621393775d71b19a878aa279c6 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 26 Jun 2018 10:31:05 -0400 Subject: [PATCH] Introduce message cell footer view. --- .../Cells/OWSMessageBubbleView.m | 28 ------------------- .../Cells/OWSMessageFooterView.m | 25 ----------------- .../Attachments/OWSAttachmentsProcessor.m | 2 -- .../src/Messages/OWSMessageManager.m | 6 ---- .../src/Storage/FullTextSearchFinder.swift | 3 +- 5 files changed, 1 insertion(+), 63 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index c6f662907..9eba65a80 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -269,8 +269,6 @@ NS_ASSUME_NONNULL_BEGIN self.bubbleView.bubbleColor = nil; } - // CGFloat bottomMargin = 0; - if (self.isQuotedReply) { BOOL isOutgoing = [self.viewItem.interaction isKindOfClass:TSOutgoingMessage.class]; DisplayableText *_Nullable displayableQuotedText @@ -288,8 +286,6 @@ NS_ASSUME_NONNULL_BEGIN [self.viewConstraints addObject:[quotedMessageView autoSetDimension:ALDimensionHeight toSize:quotedMessageContentSize.height]]; - // bottomMargin = 0; - [self.bubbleView addPartnerView:quotedMessageView.boundsStrokeView]; } @@ -344,27 +340,6 @@ NS_ASSUME_NONNULL_BEGIN } [self.stackView addArrangedSubview:bodyMediaView]; - // // This layout can lead to extreme cropping of media content, - // // e.g. a very tall portrait image + long caption. The media - // // view will have "max width", so the image will be cropped to - // // roughly a square. - // // TODO: Myles is considering alternatives. - // [self.viewConstraints addObjectsFromArray:@[ - // [bodyMediaView autoPinLeadingToSuperviewMarginWithInset:0], - // [bodyMediaView autoPinTrailingToSuperviewMarginWithInset:0], - // ]]; - // // We need constraints to control the vertical sizing of the media view, but we use - // // lower priority so that when a message only contains media it uses the exact bounds of - // // the message view. - // [NSLayoutConstraint - // autoSetPriority:UILayoutPriorityDefaultLow - // forConstraints:^{ - // [self.viewConstraints - // addObject:[bodyMediaView autoSetDimension:ALDimensionHeight - // toSize:bodyMediaContentSize.height]]; - // }]; - - // bottomMargin = 0; BOOL shouldStrokeMediaView = ([bodyMediaView isKindOfClass:[UIImageView class]] || [bodyMediaView isKindOfClass:[OWSContactShareView class]]); @@ -437,13 +412,10 @@ NS_ASSUME_NONNULL_BEGIN OWSFail(@"%@ could not display footer.", self.logTag); } - // TODO: Should we do this for media content too? if (textStackView) { CGSize bubbleSize = [self measureSize]; [self.viewConstraints addObjectsFromArray:@[ [self autoSetDimension:ALDimensionWidth toSize:bubbleSize.width relation:NSLayoutRelationLessThanOrEqual], - // [bodyTextView autoSetDimension:ALDimensionHeight - // toSize:bodyTextContentSize.height], ]]; } } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m index 4d854e09e..33680ccc1 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m @@ -55,31 +55,6 @@ NS_ASSUME_NONNULL_BEGIN [self.statusIndicatorView autoSetDimension:ALDimensionWidth toSize:self.statusIndicatorSize]; [self.statusIndicatorView autoSetDimension:ALDimensionHeight toSize:self.statusIndicatorSize]; self.statusIndicatorView.layer.cornerRadius = self.statusIndicatorSize * 0.5f; - - // // TODO: Review constant with Myles.0 - // UIStackView *statusStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ - // self.statusLabel, - // self.statusIndicatorView, - // ]]; - // statusStackView.axis = UILayoutConstraintAxisHorizontal; - // statusStackView.spacing = self.hSpacing; - // [self addSubview:statusStackView]; - - // [self.timestampLabel autoPinEdgeToSuperviewEdge:ALEdgeLeading]; - // [statusStackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing]; - // [self.timestampLabel autoVCenterInSuperview]; - // [statusStackView autoVCenterInSuperview]; - // [self.timestampLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 - // relation:NSLayoutRelationGreaterThanOrEqual]; [self.timestampLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom - // withInset:0 - // relation:NSLayoutRelationGreaterThanOrEqual]; - // [statusStackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 - // relation:NSLayoutRelationGreaterThanOrEqual]; [statusStackView autoPinEdgeToSuperviewEdge:ALEdgeBottom - // withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; [statusStackView autoPinEdge:ALEdgeLeading - // toEdge:ALEdgeTrailing - // ofView:self.timestampLabel - // withOffset:self.hSpacing - // relation:NSLayoutRelationGreaterThanOrEqual]; } - (void)configureFonts diff --git a/SignalServiceKit/src/Messages/Attachments/OWSAttachmentsProcessor.m b/SignalServiceKit/src/Messages/Attachments/OWSAttachmentsProcessor.m index 6aacf932f..0e1132786 100644 --- a/SignalServiceKit/src/Messages/Attachments/OWSAttachmentsProcessor.m +++ b/SignalServiceKit/src/Messages/Attachments/OWSAttachmentsProcessor.m @@ -74,8 +74,6 @@ static const CGFloat kAttachmentDownloadProgressTheta = 0.001f; for (OWSSignalServiceProtosAttachmentPointer *attachmentProto in attachmentProtos) { TSAttachmentPointer *pointer = [TSAttachmentPointer attachmentPointerFromProto:attachmentProto relay:relay]; - DDLogVerbose(@"%@ ---- creating attachment: %@", self.logTag, pointer.uniqueId); - [DDLog flushLog]; [attachmentIds addObject:pointer.uniqueId]; [pointer saveWithTransaction:transaction]; [attachmentPointers addObject:pointer]; diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index d06533ff1..6bd4c892e 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -561,9 +561,6 @@ NS_ASSUME_NONNULL_BEGIN return; } - DDLogVerbose(@"%@ ---- creating message: %@", self.logTag, attachmentsProcessor.attachmentIds); - [DDLog flushLog]; - TSIncomingMessage *_Nullable createdMessage = [self handleReceivedEnvelope:envelope withDataMessage:dataMessage attachmentIds:attachmentsProcessor.attachmentIds @@ -1110,9 +1107,6 @@ NS_ASSUME_NONNULL_BEGIN return; } - DDLogVerbose(@"%@ ---- creating message 2: %@", self.logTag, incomingMessage.attachmentIds); - [DDLog flushLog]; - [incomingMessage saveWithTransaction:transaction]; // Any messages sent from the current user - from this device or another - should be automatically marked as read. diff --git a/SignalServiceKit/src/Storage/FullTextSearchFinder.swift b/SignalServiceKit/src/Storage/FullTextSearchFinder.swift index 39e935d30..13557e32f 100644 --- a/SignalServiceKit/src/Storage/FullTextSearchFinder.swift +++ b/SignalServiceKit/src/Storage/FullTextSearchFinder.swift @@ -211,8 +211,7 @@ public class FullTextSearchFinder: NSObject { var oversizeText: String? dbConnection.read({ (transaction) in guard let attachment = message.attachment(with: transaction) else { - // This can happen during the initial save of incoming messages. - Logger.warn("Could not load attachment for search indexing.") + owsFail("Could not load attachment for search indexing.") return } guard let attachmentStream = attachment as? TSAttachmentStream else {