From c6a9078c6850f9cbb04e0cc7ee6107a89fe36f30 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 31 May 2019 21:07:21 -0700 Subject: [PATCH 01/19] Fix typo in appcast. --- Appcasts/netnewswire-beta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Appcasts/netnewswire-beta.xml b/Appcasts/netnewswire-beta.xml index bfbc9315f..6182f1a1f 100755 --- a/Appcasts/netnewswire-beta.xml +++ b/Appcasts/netnewswire-beta.xml @@ -19,7 +19,7 @@

Add explanation text to Account preferences for the Name field. (It’s just a display name and doesn’t affect authentication.)

Fixed several bugs with Feedbin syncing — it’s now more reliable. (We know of no remaining sync bugs, though of course there might be some.)

Added a placeholder web page for the Help book.

-

New app icon! But it might take a while for your Mac to notice and put in the Dock. (I wish we could speed that up, but it’s ou of our control.)

+

New app icon! But it might take a while for your Mac to notice and put in the Dock. (I wish we could speed that up, but it’s out of our control.)

]]> Fri, 31 May 2019 20:30:00 -0700 From fd02f8be1174e58f0866064457218326cee7c055 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 3 Jun 2019 04:13:58 -0500 Subject: [PATCH 02/19] Make about label uneditable --- iOS/Settings/Settings.storyboard | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 462b663f1..5afc57adf 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -420,7 +420,7 @@ - + @@ -537,7 +537,7 @@ - + @@ -823,7 +823,7 @@ - + From a697f98228557baf68fcc8ea3a1fb037554574c1 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 3 Jun 2019 04:22:58 -0500 Subject: [PATCH 03/19] Pop add controller to go back to settings after an account add --- iOS/Settings/AddAccountViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index eb78d8174..54cfef989 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -42,6 +42,7 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate func dismiss(_ viewController: UIViewController) { viewController.dismiss(animated: true, completion: nil) + navigationController?.popViewController(animated: false) } } From 6afd65858abd99ea1a39d16c378b81bd298a5a0c Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 3 Jun 2019 05:04:03 -0500 Subject: [PATCH 04/19] Add the ability to update iOS account credentials --- iOS/Settings/AddAccountViewController.swift | 5 +-- .../AddLocalAccountViewController.swift | 6 ++- .../DetailAccountViewController.swift | 43 +++++++++++++++++-- .../FeedbinAccountViewController.swift | 24 +++++++---- iOS/Settings/Settings.storyboard | 41 ++++++++++++++---- 5 files changed, 92 insertions(+), 27 deletions(-) diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index 54cfef989..c4e7a6285 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -10,7 +10,7 @@ import Account import UIKit protocol AddAccountDismissDelegate: UIViewController { - func dismiss(_ viewController: UIViewController) + func dismiss() } class AddAccountViewController: UITableViewController, AddAccountDismissDelegate { @@ -40,8 +40,7 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate } } - func dismiss(_ viewController: UIViewController) { - viewController.dismiss(animated: true, completion: nil) + func dismiss() { navigationController?.popViewController(animated: false) } diff --git a/iOS/Settings/AddLocalAccountViewController.swift b/iOS/Settings/AddLocalAccountViewController.swift index efa58085d..c89569eaf 100644 --- a/iOS/Settings/AddLocalAccountViewController.swift +++ b/iOS/Settings/AddLocalAccountViewController.swift @@ -25,13 +25,15 @@ class AddLocalAccountViewController: UIViewController { } @IBAction func cancel(_ sender: Any) { - delegate?.dismiss(self) + dismiss(animated: true, completion: nil) + delegate?.dismiss() } @IBAction func addAccountTapped(_ sender: Any) { let account = AccountManager.shared.createAccount(type: .onMyMac) account.name = nameTextField.text - delegate?.dismiss(self) + dismiss(animated: true, completion: nil) + delegate?.dismiss() } } diff --git a/iOS/Settings/DetailAccountViewController.swift b/iOS/Settings/DetailAccountViewController.swift index 11deef01e..e44fc0099 100644 --- a/iOS/Settings/DetailAccountViewController.swift +++ b/iOS/Settings/DetailAccountViewController.swift @@ -37,15 +37,26 @@ class DetailAccountViewController: UITableViewController { extension DetailAccountViewController { override func numberOfSections(in tableView: UITableView) -> Int { + + guard let account = account else { return 0 } + if account == AccountManager.shared.defaultAccount { return 1 + } else if account.type == .onMyMac { + return 2 } else { return super.numberOfSections(in: tableView) } } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = super.tableView(tableView, cellForRowAt: indexPath) + + let cell: UITableViewCell + if indexPath.section == 1, let account = account, account.type == .onMyMac { + cell = super.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 2)) + } else { + cell = super.tableView(tableView, cellForRowAt: indexPath) + } let bgView = UIView() bgView.backgroundColor = AppAssets.selectionBackgroundColor @@ -54,7 +65,7 @@ extension DetailAccountViewController { } override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { - if indexPath.section == 1 { + if indexPath.section > 0 { return true } @@ -62,8 +73,19 @@ extension DetailAccountViewController { } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - if indexPath.section == 1 { - deleteAccount() + if let account = account, account.type == .onMyMac { + if indexPath.section == 1 { + deleteAccount() + } + } else { + switch indexPath.section { + case 1: + credentials() + case 2: + deleteAccount() + default: + break + } } tableView.selectRow(at: nil, animated: true, scrollPosition: .none) @@ -73,6 +95,19 @@ extension DetailAccountViewController { private extension DetailAccountViewController { + func credentials() { + guard let account = account else { return } + switch account.type { + case .feedbin: + let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController + let addViewController = navController.topViewController as! FeedbinAccountViewController + addViewController.account = account + present(navController, animated: true) + default: + break + } + } + func deleteAccount() { let title = NSLocalizedString("Delete Account", comment: "Delete Account") let message = NSLocalizedString("Are you sure you want to delete this account? This can not be undone.", comment: "Delete Account") diff --git a/iOS/Settings/FeedbinAccountViewController.swift b/iOS/Settings/FeedbinAccountViewController.swift index d826c5086..c12d3d941 100644 --- a/iOS/Settings/FeedbinAccountViewController.swift +++ b/iOS/Settings/FeedbinAccountViewController.swift @@ -16,7 +16,7 @@ class FeedbinAccountViewController: UIViewController { @IBOutlet weak var cancelBarButtonItem: UIBarButtonItem! @IBOutlet weak var emailTextField: UITextField! @IBOutlet weak var passwordTextField: UITextField! - @IBOutlet weak var addAccountButton: UIButton! + @IBOutlet weak var actionButton: UIButton! @IBOutlet weak var errorMessageLabel: UILabel! @@ -31,18 +31,22 @@ class FeedbinAccountViewController: UIViewController { passwordTextField.delegate = self if let account = account, let credentials = try? account.retrieveBasicCredentials() { + actionButton.setTitle(NSLocalizedString("Update Credentials", comment: "Update Credentials"), for: .normal) if case .basic(let username, let password) = credentials { emailTextField.text = username passwordTextField.text = password } + } else { + actionButton.setTitle(NSLocalizedString("Add Account", comment: "Update Credentials"), for: .normal) } } @IBAction func cancel(_ sender: Any) { - delegate?.dismiss(self) + dismiss(animated: true, completion: nil) + delegate?.dismiss() } - @IBAction func addAccountTapped(_ sender: Any) { + @IBAction func action(_ sender: Any) { self.errorMessageLabel.text = nil guard emailTextField.text != nil && passwordTextField.text != nil else { @@ -56,8 +60,7 @@ class FeedbinAccountViewController: UIViewController { // When you fill in the email address via auto-complete it adds extra whitespace let emailAddress = emailTextField.text?.trimmingCharacters(in: .whitespaces) let credentials = Credentials.basic(username: emailAddress ?? "", password: passwordTextField.text ?? "") - Account.validateCredentials(type: .feedbin, credentials: credentials) { [weak self] result in - guard let self = self else { return } + Account.validateCredentials(type: .feedbin, credentials: credentials) { result in self.stopAnimtatingActivityIndicator() self.enableNavigation() @@ -73,7 +76,9 @@ class FeedbinAccountViewController: UIViewController { do { - try self.account?.removeBasicCredentials() + do { + try self.account?.removeBasicCredentials() + } catch {} try self.account?.storeCredentials(credentials) if newAccount { @@ -87,7 +92,8 @@ class FeedbinAccountViewController: UIViewController { } } - self.delegate?.dismiss(self) + self.dismiss(animated: true, completion: nil) + self.delegate?.dismiss() } catch { self.errorMessageLabel.text = NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error") } @@ -103,12 +109,12 @@ class FeedbinAccountViewController: UIViewController { private func enableNavigation() { self.cancelBarButtonItem.isEnabled = true - self.addAccountButton.isEnabled = true + self.actionButton.isEnabled = true } private func disableNavigation() { cancelBarButtonItem.isEnabled = false - addAccountButton.isEnabled = false + actionButton.isEnabled = false } private func startAnimatingActivityIndicator() { diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 5afc57adf..60212b3b2 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -368,7 +368,31 @@ - + + + + + + + + + + + + + + + + + + - - + + @@ -420,7 +444,7 @@ - + @@ -537,7 +561,7 @@ - + @@ -658,10 +682,9 @@ - + - - +