Don't repair session if there's an outstanding session request

pull/214/head
nielsandriesse 4 years ago
parent 0200673fdb
commit 1085d12a4c

@ -47,7 +47,8 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
super.viewDidLoad()
setUpGradientBackground()
setUpNavBarStyle()
setNavBarTitle(NSLocalizedString("New Closed Group", comment: ""))
let customTitleFontSize = isSmallScreen ? Values.largeFontSize : Values.veryLargeFontSize
setNavBarTitle(NSLocalizedString("New Closed Group", comment: ""), customFontSize: customTitleFontSize)
// Set up navigation bar buttons
let closeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "X"), style: .plain, target: self, action: #selector(close))
closeButton.tintColor = Colors.text

@ -141,6 +141,11 @@ public final class SessionManagementProtocol : NSObject {
@objc(repairSessionIfNeededForMessage:to:)
public static func repairSessionIfNeeded(for message: TSOutgoingMessage, to hexEncodedPublicKey: String) {
guard (message.thread as? TSGroupThread)?.groupModel.groupType == .closedGroup else { return }
var hasSentSessionRequest = false
storage.dbReadConnection.read { transaction in
hasSentSessionRequest = storage.getSessionRequestTimestamp(for: hexEncodedPublicKey, in: transaction) != nil
}
guard !hasSentSessionRequest else { return }
DispatchQueue.main.async {
storage.dbReadWriteConnection.readWrite { transaction in
let thread = TSContactThread.getOrCreateThread(withContactId: hexEncodedPublicKey, transaction: transaction)

Loading…
Cancel
Save