Skip to content
Snippets Groups Projects
Commit d1d0aa4d authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

conversation: present alert on main thread

Change-Id: Ia1c858fdf2cc3e99cc95b12f86423c67527d73d7
parent 44a5ea65
No related branches found
No related tags found
No related merge requests found
...@@ -459,13 +459,15 @@ class ConversationViewController: UIViewController, ...@@ -459,13 +459,15 @@ class ConversationViewController: UIViewController,
PHPhotoLibrary.shared().performChanges({ PHPhotoLibrary.shared().performChanges({
let request = PHAssetCreationRequest.forAsset() let request = PHAssetCreationRequest.forAsset()
request.addResource(with: .photo, fileURL: url, options: nil) request.addResource(with: .photo, fileURL: url, options: nil)
}, completionHandler: { _, error in
guard let error = error else { return }
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
self.showAlert(error: error)
} }
) {[weak self] (_, error) in })
if let error = error {
self?.showAlert(error: error)
}
}
} }
func showAlert(error: Error) { func showAlert(error: Error) {
let allert = UIAlertController(title: L10n.Conversation.errorSavingImage, message: error.localizedDescription, preferredStyle: .alert) let allert = UIAlertController(title: L10n.Conversation.errorSavingImage, message: error.localizedDescription, preferredStyle: .alert)
allert.addAction(UIAlertAction(title: "OK", style: .default)) allert.addAction(UIAlertAction(title: "OK", style: .default))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment