Make FeedlyOAuthAccountAuthorizationOperation not a MainThreadOperation, since we’re moving away from MainThreadOperationQueue.

This commit is contained in:
Brent Simmons
2024-05-15 09:31:16 -07:00
parent ab4d51b462
commit 01f08b9f27
3 changed files with 39 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ protocol AddAccountDismissDelegate: UIViewController {
@MainActor func dismiss()
}
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
final class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
private enum AddAccountSections: Int, CaseIterable {
case local = 0
@@ -66,7 +66,9 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
}
}
}
private var feedlyAddAccountOperation: FeedlyOAuthAccountAuthorizationOperation?
override func viewDidLoad() {
super.viewDidLoad()
}
@@ -198,10 +200,15 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
addViewController.delegate = self
present(navController, animated: true)
case .feedly:
let addAccount = FeedlyOAuthAccountAuthorizationOperation(accountType: .feedly, secretsProvider: Secrets())
let addAccount = FeedlyOAuthAccountAuthorizationOperation(secretsProvider: Secrets())
addAccount.delegate = self
addAccount.presentationAnchor = self.view.window!
MainThreadOperationQueue.shared.add(addAccount)
feedlyAddAccountOperation = addAccount
Task { @MainActor in
addAccount.run()
}
case .newsBlur:
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "NewsBlurAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext
@@ -224,6 +231,8 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
}
// MARK: - FeedlyOAuthAccountAuthorizationOperationDelegate
extension AddAccountViewController: FeedlyOAuthAccountAuthorizationOperationDelegate {
func oauthAccountAuthorizationOperation(_ operation: FeedlyOAuthAccountAuthorizationOperation, didCreate account: Account) {