Fix outgoing message status for messages sent from linked devices.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent bb24ffc917
commit a3db112c50

@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:[NSMutableArray new]
expiresInSeconds:transcript.expirationDuration
expireStartedAt:transcript.expirationStartedAt];
// Since updateWithWasDelivered is a new message, updateWithWasDelivered will save it.
[textMessage updateWithWasDelivered];
// Since textMessage is a new message, updateWithWasSentAndDelivered will save it.
[textMessage updateWithWasSentAndDelivered];
}
}

@ -159,6 +159,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
- (void)updateWithCustomMessage:(NSString *)customMessage;
- (void)updateWithWasDeliveredWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
- (void)updateWithWasDelivered;
- (void)updateWithWasSentAndDelivered;
#pragma mark - Sent Recipients

@ -291,6 +291,17 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
}];
}
- (void)updateWithWasSentAndDelivered
{
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self applyChangeToSelfAndLatestOutgoingMessage:transaction
changeBlock:^(TSOutgoingMessage *message) {
[message setMessageState:TSOutgoingMessageStateSentToService];
[message setWasDelivered:YES];
}];
}];
}
#pragma mark - Sent Recipients
- (NSArray<NSString *> *)sentRecipients

@ -1005,7 +1005,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
- (void)handleMessageSentRemotely:(TSOutgoingMessage *)message sentAt:(uint64_t)sentAt
{
[message updateWithWasDelivered];
[message updateWithWasSentAndDelivered];
[self becomeConsistentWithDisappearingConfigurationForMessage:message];
[self.disappearingMessagesJob setExpirationForMessage:message expirationStartedAt:sentAt];
}

Loading…
Cancel
Save