From 67d80dbaec41089fcffcd0869d9000033c4b84f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiel=20Gillard=20=F0=9F=A4=AA?= Date: Tue, 22 Sep 2020 09:49:59 +1000 Subject: [PATCH] Activate NetNewsWire after authorizing it with Feedly so users are not left in their browser, unable to see the result of authorizing NNW. --- .../Accounts/AccountsAddViewController.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Mac/Preferences/Accounts/AccountsAddViewController.swift b/Mac/Preferences/Accounts/AccountsAddViewController.swift index 98f2e093a..3e40d33d7 100644 --- a/Mac/Preferences/Accounts/AccountsAddViewController.swift +++ b/Mac/Preferences/Accounts/AccountsAddViewController.swift @@ -148,6 +148,12 @@ extension AccountsAddViewController: AccountsAddTableCellViewDelegate { extension AccountsAddViewController: OAuthAccountAuthorizationOperationDelegate { func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) { + // `OAuthAccountAuthorizationOperation` is using `ASWebAuthenticationSession` which bounces the user + // to their browser on macOS for authorizing NetNewsWire to access the user's Feedly account. + // When this authorization is granted, the browser remains the foreground app which is unfortunate + // because the user probably wants to see the result of authorizing NetNewsWire to act on their behalf. + NSApp.activate(ignoringOtherApps: true) + account.refreshAll { [weak self] result in switch result { case .success: @@ -159,6 +165,10 @@ extension AccountsAddViewController: OAuthAccountAuthorizationOperationDelegate } func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didFailWith error: Error) { + // `OAuthAccountAuthorizationOperation` is using `ASWebAuthenticationSession` which bounces the user + // to their browser on macOS for authorizing NetNewsWire to access the user's Feedly account. + NSApp.activate(ignoringOtherApps: true) + view.window?.presentError(error) } }