Convert AccountDelegate.refreshAll to async/await.

This commit is contained in:
Brent Simmons
2024-03-26 17:31:46 -07:00
parent f6719d8b4f
commit 39f639244b
17 changed files with 153 additions and 128 deletions

View File

@@ -226,20 +226,17 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
extension AddAccountViewController: OAuthAccountAuthorizationOperationDelegate {
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) {
let rootViewController = view.window?.rootViewController
account.refreshAll { result in
switch result {
case .success:
break
case .failure(let error):
guard let viewController = rootViewController else {
return
}
viewController.presentError(error)
Task { @MainActor in
do {
try await account.refreshAll()
} catch {
rootViewController?.presentError(error)
}
}
dismiss()
}