Compare commits
2 Commits
master
...
mkirk/only
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2737845c25 | ||
|
|
388f75ef04 |
@ -594,6 +594,19 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
||||
{
|
||||
TSThread *thread = message.thread;
|
||||
|
||||
#ifdef DEBUG
|
||||
// Assert that we're only sending sync messages when necessary
|
||||
if ([message isKindOfClass:[OWSOutgoingSyncMessage class]]) {
|
||||
__block BOOL hasSecondaryDevices = NO;
|
||||
[self.storageManager.dbConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
|
||||
hasSecondaryDevices = [OWSDevice hasSecondaryDevicesWithTransaction:transaction];
|
||||
}];
|
||||
if (!hasSecondaryDevices) {
|
||||
OWSFail(@"Sending sync message when we have no devices to sync to.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
dispatch_async([OWSDispatch sendingQueue], ^{
|
||||
if ([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
TSGroupThread *gThread = (TSGroupThread *)thread;
|
||||
@ -1089,10 +1102,16 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
||||
- (void)handleMessageSentLocally:(TSOutgoingMessage *)message
|
||||
{
|
||||
if (message.shouldSyncTranscript) {
|
||||
// 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];
|
||||
__block BOOL hasSecondaryDevices = NO;
|
||||
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
|
||||
hasSecondaryDevices = [OWSDevice hasSecondaryDevicesWithTransaction:transaction];
|
||||
}];
|
||||
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];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user