Reduce footprint of Account credentials API

This commit is contained in:
Maurice Parker
2019-06-20 11:19:15 -05:00
parent 2756e8f204
commit 1ac1144b2d
5 changed files with 37 additions and 33 deletions

View File

@@ -42,10 +42,9 @@ class AccountsReaderAPIWindowController: NSWindowController {
}
}
if let account = account, let credentials = try? account.retrieveBasicCredentials() {
if case .basic(let username, let password) = credentials {
if let account = account, let credentials = try? account.retrieveCredentials() {
if case .basic(let username, _) = credentials {
usernameTextField.stringValue = username
passwordTextField.stringValue = password
}
actionButton.title = NSLocalizedString("Update", comment: "Update")
} else {
@@ -110,7 +109,7 @@ class AccountsReaderAPIWindowController: NSWindowController {
do {
self.account?.endpointURL = apiURL
try self.account?.removeReaderAPIAuthCredentials()
try self.account?.removeCredentials()
try self.account?.storeCredentials(validatedCredentials)
if newAccount {