no need to send sync messages when only 1 device

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 8b04e2a880
commit 6566ea694c

@ -1089,10 +1089,16 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
- (void)handleMessageSentLocally:(TSOutgoingMessage *)message - (void)handleMessageSentLocally:(TSOutgoingMessage *)message
{ {
if (message.shouldSyncTranscript) { if (message.shouldSyncTranscript) {
// TODO: I suspect we shouldn't optimistically set hasSyncedTranscript. __block BOOL hasSecondaryDevices = NO;
// We could set this in a success handler for [sendSyncTranscriptForMessage:]. [self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
[message updateWithHasSyncedTranscript:YES]; hasSecondaryDevices = [OWSDevice hasSecondaryDevicesWithTransaction:transaction];
[self sendSyncTranscriptForMessage:message]; }];
if (hasSecondaryDevices) {
// TODO: I suspect we shouldn't optimistically set hasSyncedTranscript.
// We could set this in a success handler for [sendSyncTranscriptForMessage:].
[message updateWithHasSyncedTranscript:YES];
[self sendSyncTranscriptForMessage:message];
}
} }
[OWSDisappearingMessagesJob setExpirationForMessage:message]; [OWSDisappearingMessagesJob setExpirationForMessage:message];

Loading…
Cancel
Save