From 6486b994158bb4b652b3e94480901fc50225ec7a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 24 Apr 2018 10:36:17 -0400 Subject: [PATCH] Clean up ahead of PR. --- .../src/Messages/Interactions/TSOutgoingMessage.h | 9 +++++++-- .../src/Messages/Interactions/TSOutgoingMessage.m | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.h b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.h index cbfd188df..701514c00 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.h @@ -153,14 +153,19 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) { - (BOOL)shouldBeSaved; +// All recipients of this message. - (NSArray *)recipientIds; +// All recipients of this message who we are currently trying to send to (queued, uploading or doing send). - (NSArray *)sendingRecipientIds; +// All recipients of this message to whom it has been sent and delivered. - (NSArray *)deliveredRecipientIds; +// All recipients of this message to whom it has been sent, delivered and read. - (NSArray *)readRecipientIds; +// Number of recipients of this message to whom it has been sent. - (NSUInteger)sentRecipientsCount; - (nullable TSOutgoingMessageRecipientState *)recipientStateForRecipientId:(NSString *)recipientId; @@ -179,11 +184,11 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) { // When we start a message send, all "failed" recipients should be marked as "sending". - (void)updateWithMarkingAllUnsentRecipientsAsSendingWithTransaction:(YapDatabaseReadWriteTransaction *)transaction; -#ifdef DEBUG // This method is used to forge the message state for fake messages. +// +// NOTE: This method should only be used by Debug UI, etc. - (void)updateWithFakeMessageState:(TSOutgoingMessageState)messageState transaction:(YapDatabaseReadWriteTransaction *)transaction; -#endif // This method is used to record a failed send to all "sending" recipients. - (void)updateWithSendingError:(NSError *)error; diff --git a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m index cc4468a82..e8fb5a37b 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m @@ -267,6 +267,8 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec _attachmentFilenameMap = [NSMutableDictionary new]; + // New outgoing messages should immediately determine their + // recipient list from current thread state. NSMutableDictionary *recipientStateMap = [NSMutableDictionary new]; NSArray *recipientIds = [self.thread recipientIdentifiers]; for (NSString *recipientId in recipientIds) {