From 039755c0dfc7a31156ff89f1f7067ed0ed7e12cc Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 18 Dec 2018 13:35:49 -0500 Subject: [PATCH] Respond to CR. --- Signal/src/Models/MessageActions.swift | 12 ++++++------ .../ConversationView/Cells/ConversationViewCell.h | 6 +++--- .../ConversationView/Cells/OWSMessageCell.m | 12 ++++++------ .../ConversationView/ConversationViewController.m | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Signal/src/Models/MessageActions.swift b/Signal/src/Models/MessageActions.swift index 4a201baef..70dedc60b 100644 --- a/Signal/src/Models/MessageActions.swift +++ b/Signal/src/Models/MessageActions.swift @@ -71,10 +71,10 @@ struct MessageActionBuilder { class ConversationViewItemActions: NSObject { @objc - class func textActions(conversationViewItem: ConversationViewItem, isFailedOrSending: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { + class func textActions(conversationViewItem: ConversationViewItem, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { var actions: [MenuAction] = [] - if !isFailedOrSending { + if shouldAllowReply { let replyAction = MessageActionBuilder.reply(conversationViewItem: conversationViewItem, delegate: delegate) actions.append(replyAction) } @@ -94,10 +94,10 @@ class ConversationViewItemActions: NSObject { } @objc - class func mediaActions(conversationViewItem: ConversationViewItem, isFailedOrSending: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { + class func mediaActions(conversationViewItem: ConversationViewItem, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { var actions: [MenuAction] = [] - if !isFailedOrSending { + if shouldAllowReply { let replyAction = MessageActionBuilder.reply(conversationViewItem: conversationViewItem, delegate: delegate) actions.append(replyAction) } @@ -123,10 +123,10 @@ class ConversationViewItemActions: NSObject { } @objc - class func quotedMessageActions(conversationViewItem: ConversationViewItem, isFailedOrSending: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { + class func quotedMessageActions(conversationViewItem: ConversationViewItem, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { var actions: [MenuAction] = [] - if !isFailedOrSending { + if shouldAllowReply { let replyAction = MessageActionBuilder.reply(conversationViewItem: conversationViewItem, delegate: delegate) actions.append(replyAction) } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/ConversationViewCell.h b/Signal/src/ViewControllers/ConversationView/Cells/ConversationViewCell.h index 12ed7e2fd..d8617b62f 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/ConversationViewCell.h +++ b/Signal/src/ViewControllers/ConversationView/Cells/ConversationViewCell.h @@ -22,13 +22,13 @@ NS_ASSUME_NONNULL_BEGIN @protocol ConversationViewCellDelegate - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressTextViewItem:(id)viewItem; - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressMediaViewItem:(id)viewItem; - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressQuoteViewItem:(id)viewItem; - (void)conversationCell:(ConversationViewCell *)cell didLongpressSystemMessageViewItem:(id)viewItem; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index da89b5656..a8429c7aa 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -423,15 +423,15 @@ NS_ASSUME_NONNULL_BEGIN return; } - BOOL isFailedOrSending = NO; + BOOL shouldAllowReply = YES; if (self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage) { TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.viewItem.interaction; if (outgoingMessage.messageState == TSOutgoingMessageStateFailed) { // Don't allow "delete" or "reply" on "failed" outgoing messages. - isFailedOrSending = YES; + shouldAllowReply = NO; } else if (outgoingMessage.messageState == TSOutgoingMessageStateSending) { // Don't allow "delete" or "reply" on "sending" outgoing messages. - isFailedOrSending = YES; + shouldAllowReply = NO; } } @@ -440,19 +440,19 @@ NS_ASSUME_NONNULL_BEGIN case OWSMessageGestureLocation_Default: case OWSMessageGestureLocation_OversizeText: { [self.delegate conversationCell:self - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply didLongpressTextViewItem:self.viewItem]; break; } case OWSMessageGestureLocation_Media: { [self.delegate conversationCell:self - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply didLongpressMediaViewItem:self.viewItem]; break; } case OWSMessageGestureLocation_QuotedReply: { [self.delegate conversationCell:self - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply didLongpressQuoteViewItem:self.viewItem]; break; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 91445cfd5..3284f28a3 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1924,34 +1924,34 @@ typedef enum : NSUInteger { #pragma mark - ConversationViewCellDelegate - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressMediaViewItem:(id)viewItem { NSArray *messageActions = [ConversationViewItemActions mediaActionsWithConversationViewItem:viewItem - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply delegate:self]; [self presentMessageActions:messageActions withFocusedCell:cell]; } - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressTextViewItem:(id)viewItem { NSArray *messageActions = [ConversationViewItemActions textActionsWithConversationViewItem:viewItem - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply delegate:self]; [self presentMessageActions:messageActions withFocusedCell:cell]; } - (void)conversationCell:(ConversationViewCell *)cell - isFailedOrSending:(BOOL)isFailedOrSending + shouldAllowReply:(BOOL)shouldAllowReply didLongpressQuoteViewItem:(id)viewItem { NSArray *messageActions = [ConversationViewItemActions quotedMessageActionsWithConversationViewItem:viewItem - isFailedOrSending:isFailedOrSending + shouldAllowReply:shouldAllowReply delegate:self]; [self presentMessageActions:messageActions withFocusedCell:cell]; }