[Fix]: operate on UI controls in main thread

This commit is contained in:
Magesh K
2024-12-28 02:12:03 +05:30
committed by June
parent ff1defeec5
commit f6482eb06e

View File

@@ -555,26 +555,26 @@ private extension AuthenticationOperation
} }
} }
let alertController = UIAlertController(title: NSLocalizedString("Would you like to revoke your previous certificates?\n\(certsText)", comment: ""), message: nil, preferredStyle: .alert) DispatchQueue.main.async {
let alertController = UIAlertController(title: NSLocalizedString("Would you like to revoke your previous certificates?\n\(certsText)", comment: ""), message: nil, preferredStyle: .alert)
let noAction = UIAlertAction(title: NSLocalizedString("No", comment: ""), style: .default) { (action) in
requestCertificate() let noAction = UIAlertAction(title: NSLocalizedString("No", comment: ""), style: .default) { (action) in
} requestCertificate()
let yesAction = UIAlertAction(title: NSLocalizedString("Yes", comment: ""), style: .default) { (action) in }
for certificate in ourCertificates { let yesAction = UIAlertAction(title: NSLocalizedString("Yes", comment: ""), style: .default) { (action) in
ALTAppleAPI.shared.revoke(certificate, for: team, session: session) { (success, error) in for certificate in ourCertificates {
if let error = error, !success ALTAppleAPI.shared.revoke(certificate, for: team, session: session) { (success, error) in
{ if let error = error, !success
completionHandler(.failure(error)) {
completionHandler(.failure(error))
}
} }
} }
requestCertificate()
} }
requestCertificate() alertController.addAction(noAction)
} alertController.addAction(yesAction)
alertController.addAction(noAction)
alertController.addAction(yesAction)
DispatchQueue.main.async {
if self.navigationController.presentingViewController != nil if self.navigationController.presentingViewController != nil
{ {
self.navigationController.present(alertController, animated: true, completion: nil) self.navigationController.present(alertController, animated: true, completion: nil)