Fix note to self
This commit is contained in:
parent
746f3e34bd
commit
b847590ecd
|
@ -75,7 +75,13 @@ public final class SessionMetaProtocol : NSObject {
|
|||
public static func shouldSendTranscript(for message: TSOutgoingMessage, in thread: TSThread) -> Bool {
|
||||
let isOpenGroupMessage = (thread as? TSGroupThread)?.isPublicChat == true
|
||||
let wouldSignalRequireTranscript = (AreRecipientUpdatesEnabled() || !message.hasSyncedTranscript)
|
||||
return wouldSignalRequireTranscript && !isOpenGroupMessage
|
||||
guard wouldSignalRequireTranscript && !isOpenGroupMessage else { return false }
|
||||
var usesMultiDevice = false
|
||||
storage.dbReadConnection.read { transaction in
|
||||
usesMultiDevice = !storage.getDeviceLinks(for: getUserHexEncodedPublicKey(), in: transaction).isEmpty
|
||||
|| UserDefaults.standard[.masterHexEncodedPublicKey] != nil
|
||||
}
|
||||
return usesMultiDevice && isThreadNoteToSelf(thread)
|
||||
}
|
||||
|
||||
// MARK: Typing Indicators
|
||||
|
|
|
@ -1521,7 +1521,22 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
OWSOutgoingSentMessageTranscript *sentMessageTranscript =
|
||||
[[OWSOutgoingSentMessageTranscript alloc] initWithOutgoingMessage:message isRecipientUpdate:isRecipientUpdate];
|
||||
|
||||
NSString *recipientId = self.tsAccountManager.localNumber;
|
||||
NSString *currentDevice = self.tsAccountManager.localNumber;
|
||||
|
||||
// Loki: Send to the other device, but not self
|
||||
__block NSSet<NSString *> *linkedDevices;
|
||||
[self.primaryStorage.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
linkedDevices = [LKDatabaseUtilities getLinkedDeviceHexEncodedPublicKeysFor:currentDevice in:transaction];
|
||||
}];
|
||||
NSString *otherDevice;
|
||||
for (NSString *device in linkedDevices) {
|
||||
if (![device isEqual:currentDevice]) {
|
||||
otherDevice = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *recipientId = otherDevice ?: currentDevice;
|
||||
__block SignalRecipient *recipient;
|
||||
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
recipient = [SignalRecipient markRecipientAsRegisteredAndGet:recipientId transaction:transaction];
|
||||
|
@ -1550,15 +1565,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
failure(error);
|
||||
}];
|
||||
|
||||
if ([LKMultiDeviceProtocol isMultiDeviceRequiredForMessage:message]) { // Avoid the write transaction if possible
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.primaryStorage.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[LKMultiDeviceProtocol sendMessageToDestinationAndLinkedDevices:messageSend in:transaction];
|
||||
}];
|
||||
});
|
||||
} else {
|
||||
[self sendMessage:messageSend];
|
||||
}
|
||||
[self sendMessage:messageSend];
|
||||
}
|
||||
|
||||
- (NSArray<NSDictionary *> *)throws_deviceMessagesForMessageSend:(OWSMessageSend *)messageSend
|
||||
|
|
Loading…
Reference in New Issue