Merge branch 'charlesmchen/fixMessagesFromLinkedDevices'

pull/1/head
Matthew Chen 8 years ago
commit 51689b3341

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

@ -159,6 +159,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
- (void)updateWithCustomMessage:(NSString *)customMessage; - (void)updateWithCustomMessage:(NSString *)customMessage;
- (void)updateWithWasDeliveredWithTransaction:(YapDatabaseReadWriteTransaction *)transaction; - (void)updateWithWasDeliveredWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
- (void)updateWithWasDelivered; - (void)updateWithWasDelivered;
- (void)updateWithWasSentAndDelivered;
#pragma mark - Sent Recipients #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 #pragma mark - Sent Recipients
- (NSArray<NSString *> *)sentRecipients - (NSArray<NSString *> *)sentRecipients

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

Loading…
Cancel
Save