mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Automatically refreshes a new Feedly account after its creation.
This commit is contained in:
@@ -10,6 +10,7 @@ import Foundation
|
||||
import AuthenticationServices
|
||||
|
||||
public protocol OAuthAccountAuthorizationOperationDelegate: class {
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account)
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didFailWith error: Error)
|
||||
}
|
||||
|
||||
@@ -126,6 +127,8 @@ public final class OAuthAccountAuthorizationOperation: Operation, ASWebAuthentic
|
||||
|
||||
// Now store the access token because we want the account delegate to use it.
|
||||
try account.storeCredentials(grant.accessToken)
|
||||
|
||||
delegate?.oauthAccountAuthorizationOperation(self, didCreate: account)
|
||||
|
||||
didFinish()
|
||||
} catch {
|
||||
|
||||
@@ -119,6 +119,17 @@ extension AccountsAddViewController: NSTableViewDelegate {
|
||||
|
||||
extension AccountsAddViewController: OAuthAccountAuthorizationOperationDelegate {
|
||||
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) {
|
||||
account.refreshAll { [weak self] result in
|
||||
switch result {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
self?.presentError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didFailWith error: Error) {
|
||||
view.window?.presentError(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user