Enhance OAuth error handling.
This commit is contained in:
parent
e206909237
commit
ad6d5ef7ed
|
@ -8,6 +8,7 @@
|
|||
<customObject id="-2" userLabel="File's Owner" customClass="ExtensionPointEnableWindowController" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="descriptionLabel" destination="thC-ep-vXS" id="o9I-vp-z54"/>
|
||||
<outlet property="enableButton" destination="sGb-z5-IdF" id="yNw-Nn-4Kq"/>
|
||||
<outlet property="imageView" destination="LSA-B8-aGZ" id="AN5-t1-d52"/>
|
||||
<outlet property="titleLabel" destination="iAC-tU-rvZ" id="vMx-2H-b44"/>
|
||||
<outlet property="window" destination="HNe-Jr-kev" id="C8n-l1-WhI"/>
|
||||
|
|
|
@ -16,6 +16,7 @@ class ExtensionPointEnableWindowController: NSWindowController {
|
|||
@IBOutlet weak var imageView: NSImageView!
|
||||
@IBOutlet weak var titleLabel: NSTextField!
|
||||
@IBOutlet weak var descriptionLabel: NSTextField!
|
||||
@IBOutlet weak var enableButton: NSButton!
|
||||
|
||||
private weak var hostWindow: NSWindow?
|
||||
|
||||
|
@ -53,6 +54,8 @@ class ExtensionPointEnableWindowController: NSWindowController {
|
|||
@IBAction func enable(_ sender: Any) {
|
||||
guard let extensionPointType = extensionPointType else { return }
|
||||
|
||||
enableButton.isEnabled = false
|
||||
|
||||
if let oauth1 = extensionPointType as? OAuth1SwiftProvider.Type {
|
||||
enableOauth1(oauth1)
|
||||
} else {
|
||||
|
@ -76,7 +79,11 @@ extension ExtensionPointEnableWindowController: OAuthSwiftURLHandlerType {
|
|||
|
||||
self.oauth?.cancel()
|
||||
self.oauth = nil
|
||||
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.hostWindow!.endSheet(self.window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
|
||||
if case ASWebAuthenticationSessionError.canceledLogin = error {
|
||||
print("Login cancelled.")
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue