|
|
|
@ -336,8 +336,7 @@ class MessageRequestsViewController: BaseVC, UITableViewDelegate, UITableViewDat
|
|
|
|
|
let alertVC: UIAlertController = UIAlertController(title: NSLocalizedString("MESSAGE_REQUESTS_CLEAR_ALL_CONFIRMATION_TITLE", comment: ""), message: nil, preferredStyle: .actionSheet)
|
|
|
|
|
alertVC.addAction(UIAlertAction(title: NSLocalizedString("MESSAGE_REQUESTS_CLEAR_ALL_CONFIRMATION_ACTON", comment: ""), style: .destructive) { _ in
|
|
|
|
|
// Clear the requests
|
|
|
|
|
Storage.write(
|
|
|
|
|
with: { [weak self] transaction in
|
|
|
|
|
Storage.write { [weak self] transaction in
|
|
|
|
|
threads.forEach { thread in
|
|
|
|
|
if let uniqueId: String = thread.uniqueId {
|
|
|
|
|
Storage.shared.cancelPendingMessageSendJobs(for: uniqueId, using: transaction)
|
|
|
|
@ -360,14 +359,12 @@ class MessageRequestsViewController: BaseVC, UITableViewDelegate, UITableViewDat
|
|
|
|
|
needsSync = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
completion: {
|
|
|
|
|
|
|
|
|
|
// Force a config sync
|
|
|
|
|
if needsSync {
|
|
|
|
|
MessageSender.syncConfiguration(forceSyncNow: true).retainUntilComplete()
|
|
|
|
|
MessageSender.syncConfiguration(forceSyncNow: true, with: transaction).retainUntilComplete()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
alertVC.addAction(UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .cancel, handler: nil))
|
|
|
|
|
self.present(alertVC, animated: true, completion: nil)
|
|
|
|
@ -378,8 +375,7 @@ class MessageRequestsViewController: BaseVC, UITableViewDelegate, UITableViewDat
|
|
|
|
|
|
|
|
|
|
let alertVC: UIAlertController = UIAlertController(title: NSLocalizedString("MESSAGE_REQUESTS_DELETE_CONFIRMATION_ACTON", comment: ""), message: nil, preferredStyle: .actionSheet)
|
|
|
|
|
alertVC.addAction(UIAlertAction(title: NSLocalizedString("TXT_DELETE_TITLE", comment: ""), style: .destructive) { _ in
|
|
|
|
|
Storage.write(
|
|
|
|
|
with: { [weak self] transaction in
|
|
|
|
|
Storage.write { [weak self] transaction in
|
|
|
|
|
Storage.shared.cancelPendingMessageSendJobs(for: uniqueId, using: transaction)
|
|
|
|
|
self?.updateContactAndThread(thread: thread, with: transaction)
|
|
|
|
|
|
|
|
|
@ -392,12 +388,10 @@ class MessageRequestsViewController: BaseVC, UITableViewDelegate, UITableViewDat
|
|
|
|
|
contact.isBlocked = true
|
|
|
|
|
Storage.shared.setContact(contact, using: transaction)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
completion: {
|
|
|
|
|
|
|
|
|
|
// Force a config sync
|
|
|
|
|
MessageSender.syncConfiguration(forceSyncNow: true).retainUntilComplete()
|
|
|
|
|
MessageSender.syncConfiguration(forceSyncNow: true, with: transaction).retainUntilComplete()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
alertVC.addAction(UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .cancel, handler: nil))
|
|
|
|
|
self.present(alertVC, animated: true, completion: nil)
|
|
|
|
|