This commit is contained in:
nielsandriesse 2020-04-24 12:20:52 +10:00
parent 7f1be7d428
commit faa6805dcc
3 changed files with 3 additions and 10 deletions

View file

@ -80,16 +80,9 @@ public final class LokiFileServerAPI : LokiDotNetAPI {
}
})
}.map(on: LokiAPI.workQueue) { deviceLinks -> Set<DeviceLink> in
func setDeviceLinks(in transaction: YapDatabaseReadWriteTransaction) {
storage.dbReadWriteConnection.readWrite { transaction in
storage.setDeviceLinks(deviceLinks, in: transaction)
}
if let transaction = transaction, transaction.connection.pendingTransactionCount != 0 { // TODO: Does keeping the transaction this long even make sense?
setDeviceLinks(in: transaction)
} else {
storage.dbReadWriteConnection.readWrite { transaction in
setDeviceLinks(in: transaction)
}
}
return deviceLinks
}
}

View file

@ -43,7 +43,7 @@ public final class MultiDeviceProtocol : NSObject {
// TODO: I'm pretty sure there are quite a few holes in this logic
let message = messageSend.message
let recipientID = messageSend.recipient.recipientId()
let thread = messageSend.thread!
let thread = messageSend.thread ?? TSContactThread.getOrCreateThread(withContactId: recipientID, transaction: transaction) // TODO: Added this because I think we need it
let isGroupMessage = thread.isGroupThread()
let isOpenGroupMessage = (thread as? TSGroupThread)?.isPublicChat == true
let isDeviceLinkMessage = message is DeviceLinkMessage

View file

@ -232,7 +232,7 @@ void AssertIsOnSendingQueue()
- (void)didSucceed
{
if (self.message.messageState != TSOutgoingMessageStateSent) {
OWSFailDebug(@"unexpected message status: %@", self.message.statusDescription);
[LKLogger print:@"[Loki] Succeeded with sending a message, but the message state isn't TSOutgoingMessageStateSent."];
}
self.successHandler();