pull/162/head
nielsandriesse 6 years ago
parent 7f1be7d428
commit faa6805dcc

@ -80,15 +80,8 @@ public final class LokiFileServerAPI : LokiDotNetAPI {
} }
}) })
}.map(on: LokiAPI.workQueue) { deviceLinks -> Set<DeviceLink> in }.map(on: LokiAPI.workQueue) { deviceLinks -> Set<DeviceLink> in
func setDeviceLinks(in transaction: YapDatabaseReadWriteTransaction) {
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 storage.dbReadWriteConnection.readWrite { transaction in
setDeviceLinks(in: transaction) storage.setDeviceLinks(deviceLinks, in: transaction)
}
} }
return deviceLinks return deviceLinks
} }

@ -43,7 +43,7 @@ public final class MultiDeviceProtocol : NSObject {
// TODO: I'm pretty sure there are quite a few holes in this logic // TODO: I'm pretty sure there are quite a few holes in this logic
let message = messageSend.message let message = messageSend.message
let recipientID = messageSend.recipient.recipientId() 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 isGroupMessage = thread.isGroupThread()
let isOpenGroupMessage = (thread as? TSGroupThread)?.isPublicChat == true let isOpenGroupMessage = (thread as? TSGroupThread)?.isPublicChat == true
let isDeviceLinkMessage = message is DeviceLinkMessage let isDeviceLinkMessage = message is DeviceLinkMessage

@ -232,7 +232,7 @@ void AssertIsOnSendingQueue()
- (void)didSucceed - (void)didSucceed
{ {
if (self.message.messageState != TSOutgoingMessageStateSent) { 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(); self.successHandler();

Loading…
Cancel
Save