Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent d40862fd70
commit 77e0c9664c

@ -43,6 +43,8 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread
{ {
OWSAssert(timestamp > 0);
self = [super initWithUniqueId:nil]; self = [super initWithUniqueId:nil];
if (!self) { if (!self) {

@ -266,14 +266,14 @@ NS_ASSUME_NONNULL_BEGIN
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message; TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message;
NSString *contactName = [contactsManager displayNameForPhoneIdentifier:incomingMessage.messageAuthorId]; NSString *contactName = [contactsManager displayNameForPhoneIdentifier:incomingMessage.messageAuthorId];
// We want the info message to appear after the message. // We want the info message to appear _before_ the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp + 1 [[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp - 1
thread:message.thread thread:message.thread
configuration:disappearingMessagesConfiguration configuration:disappearingMessagesConfiguration
createdByRemoteName:contactName] save]; createdByRemoteName:contactName] save];
} else { } else {
// We want the info message to appear after the message. // We want the info message to appear _before_ the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp + 1 [[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp - 1
thread:message.thread thread:message.thread
configuration:disappearingMessagesConfiguration] configuration:disappearingMessagesConfiguration]
save]; save];

@ -193,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
} else { } else {
// Desktop currently sends delivery receipts for "unpersisted" messages // Desktop currently sends delivery receipts for "unpersisted" messages
// like group updates, so these errors are expected to a certain extent. // like group updates, so these errors are expected to a certain extent.
DDLogError(@"%@ Unexpected message with timestamp: %llu", self.tag, envelope.timestamp); DDLogInfo(@"%@ Unexpected message with timestamp: %llu", self.tag, envelope.timestamp);
} }
} }

@ -434,7 +434,13 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// //
// That's key - we don't want to send any messages in response // That's key - we don't want to send any messages in response
// to an incoming message until processing of that batch of messages // to an incoming message until processing of that batch of messages
// is complete. // is complete. For example, we wouldn't want to auto-reply to a
// group info request before that group info request's batch was
// finished processing. Otherwise, we might receive a delivery
// notice for a group update we hadn't yet saved to the db.
//
// So we're using YDB behavior to ensure this invariant, which is a bit
// unorthodox.
[message updateWithMessageState:TSOutgoingMessageStateAttemptingOut]; [message updateWithMessageState:TSOutgoingMessageStateAttemptingOut];
OWSSendMessageOperation *sendMessageOperation = OWSSendMessageOperation *sendMessageOperation =
@ -1328,14 +1334,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// TODO: Why is this necessary? // TODO: Why is this necessary?
[message save]; [message save];
} else if (message.groupMetaMessage == TSGroupMessageQuit) { } else if (message.groupMetaMessage == TSGroupMessageQuit) {
// We want the info message to appear after the message. [[[TSInfoMessage alloc] initWithTimestamp:message.timestamp
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp + 1
inThread:thread inThread:thread
messageType:TSInfoMessageTypeGroupQuit messageType:TSInfoMessageTypeGroupQuit
customMessage:message.customMessage] save]; customMessage:message.customMessage] save];
} else { } else {
// We want the info message to appear after the message. [[[TSInfoMessage alloc] initWithTimestamp:message.timestamp
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp + 1
inThread:thread inThread:thread
messageType:TSInfoMessageTypeGroupUpdate messageType:TSInfoMessageTypeGroupUpdate
customMessage:message.customMessage] save]; customMessage:message.customMessage] save];

Loading…
Cancel
Save