Attempt to repair session if needed
This commit is contained in:
parent
60cb5b6114
commit
807345868f
|
@ -139,6 +139,19 @@ public final class SessionManagementProtocol : NSObject {
|
|||
return promise
|
||||
}
|
||||
|
||||
@objc(repairSessionIfNeededForMessage:to:)
|
||||
public static func repairSessionIfNeeded(for message: TSOutgoingMessage, to hexEncodedPublicKey: String) {
|
||||
guard (message.thread as? TSGroupThread)?.groupModel.groupType == .closedGroup else { return }
|
||||
DispatchQueue.main.async {
|
||||
storage.dbReadWriteConnection.readWrite { transaction in
|
||||
let thread = TSContactThread.getOrCreateThread(withContactId: hexEncodedPublicKey, transaction: transaction)
|
||||
let sessionRequestMessage = SessionRequestMessage(thread: thread)
|
||||
let messageSenderJobQueue = SSKEnvironment.shared.messageSenderJobQueue
|
||||
messageSenderJobQueue.add(message: sessionRequestMessage, transaction: transaction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Receiving
|
||||
@objc(handleDecryptionError:forHexEncodedPublicKey:using:)
|
||||
public static func handleDecryptionError(_ rawValue: Int32, for hexEncodedPublicKey: String, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
|
|
|
@ -1705,6 +1705,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
*/
|
||||
|
||||
if (!bundle) {
|
||||
[LKSessionManagementProtocol repairSessionIfNeededForMessage:messageSend.message to:recipientID];
|
||||
NSString *missingPrekeyBundleException = @"missingPrekeyBundleException";
|
||||
OWSRaiseException(missingPrekeyBundleException, @"Missing pre key bundle for: %@.", recipientID);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue