From 4383f269a51b1e18eb33cd5929c90593e2a13449 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:01:14 -0500 Subject: [PATCH 01/19] Dismiss the keyboard after account name is finished editing --- iOS/Settings/DetailAccountViewController.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/iOS/Settings/DetailAccountViewController.swift b/iOS/Settings/DetailAccountViewController.swift index 43ab244f7..42107d2f1 100644 --- a/iOS/Settings/DetailAccountViewController.swift +++ b/iOS/Settings/DetailAccountViewController.swift @@ -21,6 +21,7 @@ class DetailAccountViewController: UITableViewController { guard let account = account else { return } nameTextField.text = account.name + nameTextField.delegate = self activeSwitch.isOn = account.isActive } @@ -29,5 +30,14 @@ class DetailAccountViewController: UITableViewController { account?.name = nameTextField.text account?.isActive = activeSwitch.isOn } - + +} + +extension DetailAccountViewController: UITextFieldDelegate { + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + nameTextField.resignFirstResponder() + return true + } + } From 40358f580186ce50e25a7b206d7a803f7f3485b5 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:02:31 -0500 Subject: [PATCH 02/19] =?UTF-8?q?Don=E2=80=99t=20allow=20the=20cells=20to?= =?UTF-8?q?=20be=20selected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 e04678759..b325c6555 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -314,7 +314,7 @@ - + @@ -425,7 +425,7 @@ - + @@ -509,7 +509,7 @@ - + From 438745f2464c005e8b212f76765407f6b903dbfa Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:05:20 -0500 Subject: [PATCH 03/19] Removed empty cell --- iOS/Settings/Settings.storyboard | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index b325c6555..db165ac99 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -337,7 +337,7 @@ - + @@ -378,14 +378,6 @@ - - - - - - - - @@ -425,7 +417,7 @@ - + @@ -509,7 +501,7 @@ - + From 90ea9ebb509e4bf8bfe9921f15850f877b17eefc Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:08:48 -0500 Subject: [PATCH 04/19] Disable add new item button when there are no active accounts --- iOS/Base.lproj/Main.storyboard | 1 + iOS/MasterFeed/MasterFeedViewController.swift | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index a72b987e5..3911beb62 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -259,6 +259,7 @@ + diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 3a2e69d3a..e170997c2 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -14,7 +14,8 @@ import RSTree class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunner { - @IBOutlet weak var markAllAsReadButton: UIBarButtonItem! + @IBOutlet private weak var markAllAsReadButton: UIBarButtonItem! + @IBOutlet private weak var addNewItemButton: UIBarButtonItem! var undoableCommands = [UndoableCommand]() @@ -596,6 +597,7 @@ private extension MasterFeedViewController { func updateUI() { markAllAsReadButton.isEnabled = navState.isAnyUnreadAvailable + addNewItemButton.isEnabled = !AccountManager.shared.activeAccounts.isEmpty } func configureCellsForRepresentedObject(_ representedObject: AnyObject) { From 9d72fede0591a72f0d1dedc4eb289365281df9ab Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:14:23 -0500 Subject: [PATCH 05/19] =?UTF-8?q?Don=E2=80=99t=20reference=20nameTextField?= =?UTF-8?q?=20directly=20when=20dismissing=20the=20keyboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Settings/DetailAccountViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/Settings/DetailAccountViewController.swift b/iOS/Settings/DetailAccountViewController.swift index 42107d2f1..eb6d597ac 100644 --- a/iOS/Settings/DetailAccountViewController.swift +++ b/iOS/Settings/DetailAccountViewController.swift @@ -36,7 +36,7 @@ class DetailAccountViewController: UITableViewController { extension DetailAccountViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { - nameTextField.resignFirstResponder() + textField.resignFirstResponder() return true } From 890c146c7e3a597d83201dd60e9112377a8b8092 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:17:10 -0500 Subject: [PATCH 06/19] Dismiss keyboard when text fields are done editing --- iOS/Add/AddFeedViewController.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iOS/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index 13dc65c26..d09dc98d7 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -34,12 +34,14 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh urlTextField.autocorrectionType = .no urlTextField.autocapitalizationType = .none urlTextField.text = initialFeed + urlTextField.delegate = self if initialFeed != nil { delegate?.readyToAdd(state: true) } nameTextField.text = initialFeedName + nameTextField.delegate = self pickerData = AddFeedFolderPickerData() folderPickerView.dataSource = self @@ -200,3 +202,12 @@ private extension AddFeedViewController { } } + +extension AddFeedViewController: UITextFieldDelegate { + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true + } + +} From bce45d28e4c0f56652df186d86bc8af0537239e2 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 16:52:21 -0500 Subject: [PATCH 07/19] Updated all iOS references to default local account new to be device specific --- Frameworks/Account/Account.swift | 25 ++++++++++++------- Mac/Preferences/Accounts/AccountsAddLocal.xib | 7 +++--- .../AccountsAddLocalWindowController.swift | 11 ++++++-- .../Accounts/AccountsAddViewController.swift | 3 ++- iOS/Settings/AddAccountViewController.swift | 9 +++++++ .../AddLocalAccountViewController.swift | 19 +++++++++++++- iOS/Settings/Settings.storyboard | 4 +++ 7 files changed, 62 insertions(+), 16 deletions(-) diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index f5bc4f199..ed6365030 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -67,6 +67,21 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, public static let feeds = "feeds" // AccountDidDownloadArticles, StatusesDidChange } + public static let defaultLocalAccountName: String = { + let defaultName: String + #if os(macOS) + defaultName = NSLocalizedString("On My Mac", comment: "Account name") + #else + if UIDevice.current.userInterfaceIdiom == .pad { + defaultName = NSLocalizedString("On My iPad", comment: "Account name") + } else { + defaultName = NSLocalizedString("On My iPhone", comment: "Account name") + } + #endif + + return defaultName + }() + public let accountID: String public let type: AccountType public var nameForDisplay: String { @@ -220,15 +235,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, switch type { case .onMyMac: - #if os(macOS) - defaultName = NSLocalizedString("On My Mac", comment: "Account name") - #else - if UIDevice.current.userInterfaceIdiom == .pad { - defaultName = NSLocalizedString("On My iPad", comment: "Account name") - } else { - defaultName = NSLocalizedString("On My iPhone", comment: "Account name") - } - #endif + defaultName = Account.defaultLocalAccountName case .feedly: defaultName = "Feedly" case .feedbin: diff --git a/Mac/Preferences/Accounts/AccountsAddLocal.xib b/Mac/Preferences/Accounts/AccountsAddLocal.xib index ea2ffd4b8..c035af932 100644 --- a/Mac/Preferences/Accounts/AccountsAddLocal.xib +++ b/Mac/Preferences/Accounts/AccountsAddLocal.xib @@ -7,6 +7,7 @@ + @@ -17,13 +18,13 @@ - + - + @@ -34,7 +35,7 @@ - + diff --git a/Mac/Preferences/Accounts/AccountsAddLocalWindowController.swift b/Mac/Preferences/Accounts/AccountsAddLocalWindowController.swift index f89ee0e4a..753fc4e75 100644 --- a/Mac/Preferences/Accounts/AccountsAddLocalWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsAddLocalWindowController.swift @@ -11,14 +11,21 @@ import Account class AccountsAddLocalWindowController: NSWindowController { - @IBOutlet weak var nameTextField: NSTextField! - + @IBOutlet private weak var nameTextField: NSTextField! + @IBOutlet private weak var localAccountNameTextField: NSTextField! + private weak var hostWindow: NSWindow? convenience init() { self.init(windowNibName: NSNib.Name("AccountsAddLocal")) } + override func windowDidLoad() { + super.windowDidLoad() + + localAccountNameTextField.stringValue = Account.defaultLocalAccountName + } + // MARK: API func runSheetOnWindow(_ hostWindow: NSWindow) { diff --git a/Mac/Preferences/Accounts/AccountsAddViewController.swift b/Mac/Preferences/Accounts/AccountsAddViewController.swift index 92c9d6ddf..a77a4bdd3 100644 --- a/Mac/Preferences/Accounts/AccountsAddViewController.swift +++ b/Mac/Preferences/Accounts/AccountsAddViewController.swift @@ -7,6 +7,7 @@ // import AppKit +import Account class AccountsAddViewController: NSViewController { @@ -57,7 +58,7 @@ extension AccountsAddViewController: NSTableViewDelegate { if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "Cell"), owner: nil) as? AccountsAddTableCellView { switch row { case 0: - cell.accountNameLabel?.stringValue = NSLocalizedString("On My Mac", comment: "Local") + cell.accountNameLabel?.stringValue = Account.defaultLocalAccountName cell.accountImageView?.image = AppImages.accountLocal case 1: cell.accountNameLabel?.stringValue = NSLocalizedString("Feedbin", comment: "Feedbin") diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index a3c16d824..a109fe2ed 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -6,10 +6,19 @@ // Copyright © 2019 Ranchero Software. All rights reserved. // +import Account import UIKit class AddAccountViewController: UITableViewController { + @IBOutlet private weak var localAccountNameLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + localAccountNameLabel.text = Account.defaultLocalAccountName + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { switch indexPath.row { case 0: diff --git a/iOS/Settings/AddLocalAccountViewController.swift b/iOS/Settings/AddLocalAccountViewController.swift index c7ffbf08d..b2c789627 100644 --- a/iOS/Settings/AddLocalAccountViewController.swift +++ b/iOS/Settings/AddLocalAccountViewController.swift @@ -11,8 +11,16 @@ import Account class AddLocalAccountViewController: UIViewController { + @IBOutlet private weak var localAccountNameLabel: UILabel! @IBOutlet weak var nameTextField: UITextField! - + + override func viewDidLoad() { + super.viewDidLoad() + + localAccountNameLabel.text = Account.defaultLocalAccountName + nameTextField.delegate = self + } + @IBAction func cancel(_ sender: Any) { dismiss(animated: true) } @@ -24,3 +32,12 @@ class AddLocalAccountViewController: UIViewController { } } + +extension AddLocalAccountViewController: UITextFieldDelegate { + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true + } + +} diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index db165ac99..4ce87b266 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -484,6 +484,9 @@ + + + @@ -548,6 +551,7 @@ + From 2f82f05721a3ae47efb57fb324a59e204aef132d Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 17:47:33 -0500 Subject: [PATCH 08/19] Improved sizing of add feed modal on iPad --- iOS/Add/AddContainerViewController.swift | 2 ++ iOS/MasterFeed/MasterFeedViewController.swift | 4 +++- iOS/Settings/SettingsViewController.swift | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/iOS/Add/AddContainerViewController.swift b/iOS/Add/AddContainerViewController.swift index 28ed46514..ebd560c75 100644 --- a/iOS/Add/AddContainerViewController.swift +++ b/iOS/Add/AddContainerViewController.swift @@ -23,6 +23,8 @@ protocol AddContainerViewControllerChildDelegate: UIViewController { class AddContainerViewController: UIViewController { + static let preferredContentSizeForFormSheetDisplay = CGSize(width: 360.0, height: 400.0) + @IBOutlet weak var cancelButton: UIBarButtonItem! @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! @IBOutlet weak var addButton: UIBarButtonItem! diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index e170997c2..12a5380a9 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -434,8 +434,10 @@ class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunn @IBAction func add(_ sender: UIBarButtonItem) { let addViewController = UIStoryboard.add.instantiateInitialViewController()! - addViewController.modalPresentationStyle = .popover + addViewController.modalPresentationStyle = .formSheet + addViewController.preferredContentSize = AddContainerViewController.preferredContentSizeForFormSheetDisplay addViewController.popoverPresentationController?.barButtonItem = sender + self.present(addViewController, animated: true) } diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 2e1664f1a..f75601269 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -227,6 +227,7 @@ private extension SettingsViewController { let addNavViewController = UIStoryboard.add.instantiateInitialViewController() as! UINavigationController let addViewController = addNavViewController.topViewController as! AddContainerViewController addNavViewController.modalPresentationStyle = .formSheet + addNavViewController.preferredContentSize = AddContainerViewController.preferredContentSizeForFormSheetDisplay addViewController.initialFeed = appNewsURLString addViewController.initialFeedName = "NetNewsWire News" From 34c6341b4c9dfaa33c3d114b93a66385fe078826 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 17:48:03 -0500 Subject: [PATCH 09/19] Further sizing improvements on iPad. Only show add feed / folder pickers when there is more than 1 item to display. --- iOS/Add/Add.storyboard | 20 +++++++-------- iOS/Add/AddFeedViewController.swift | 37 +++++++++++++++++++-------- iOS/Add/AddFolderViewController.swift | 36 ++++++++++++++++++++++---- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/iOS/Add/Add.storyboard b/iOS/Add/Add.storyboard index 95c8fb579..a758f7b38 100644 --- a/iOS/Add/Add.storyboard +++ b/iOS/Add/Add.storyboard @@ -14,7 +14,7 @@ - + @@ -100,15 +100,15 @@ - - + + - + - + @@ -242,7 +242,7 @@ - + @@ -305,15 +305,15 @@ - - + + - + - + diff --git a/iOS/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index d09dc98d7..fe3efe26f 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -14,12 +14,15 @@ import RSParser class AddFeedViewController: UITableViewController, AddContainerViewControllerChild { - @IBOutlet weak var urlTextField: UITextField! - @IBOutlet weak var nameTextField: UITextField! - @IBOutlet weak var folderPickerView: UIPickerView! - @IBOutlet weak var folderLabel: UILabel! + @IBOutlet private weak var urlTextField: UITextField! + @IBOutlet private weak var nameTextField: UITextField! + @IBOutlet private weak var folderPickerView: UIPickerView! + @IBOutlet private weak var folderLabel: UILabel! - private var pickerData: AddFeedFolderPickerData! + private lazy var pickerData: AddFeedFolderPickerData = AddFeedFolderPickerData() + private var shouldDisplayPicker: Bool { + return pickerData.containerNames.count > 1 + } private var userCancelled = false @@ -42,13 +45,16 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh nameTextField.text = initialFeedName nameTextField.delegate = self + folderLabel.text = pickerData.containerNames.first + + if shouldDisplayPicker { + folderPickerView.dataSource = self + folderPickerView.delegate = self + folderPickerView.showsSelectionIndicator = true + } else { + folderPickerView.isHidden = true + } - pickerData = AddFeedFolderPickerData() - folderPickerView.dataSource = self - folderPickerView.delegate = self - folderPickerView.showsSelectionIndicator = true - folderLabel.text = pickerData.containerNames[0] - // I couldn't figure out the gap at the top of the UITableView, so I took a hammer to it. tableView.contentInset = UIEdgeInsets(top: -28, left: 0, bottom: 0, right: 0) @@ -119,6 +125,15 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh delegate?.readyToAdd(state: urlTextField.text?.rs_stringMayBeURL() ?? false) } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if section == 1 { + return shouldDisplayPicker ? 2 : 1 + } + + return super.tableView(tableView, numberOfRowsInSection: section) + } + + } extension AddFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { diff --git a/iOS/Add/AddFolderViewController.swift b/iOS/Add/AddFolderViewController.swift index 7bca799e3..3f2d9e6f1 100644 --- a/iOS/Add/AddFolderViewController.swift +++ b/iOS/Add/AddFolderViewController.swift @@ -12,9 +12,13 @@ import RSCore class AddFolderViewController: UITableViewController, AddContainerViewControllerChild { - @IBOutlet weak var nameTextField: UITextField! - @IBOutlet weak var accountLabel: UILabel! - @IBOutlet weak var accountPickerView: UIPickerView! + @IBOutlet private weak var nameTextField: UITextField! + @IBOutlet private weak var accountLabel: UILabel! + @IBOutlet private weak var accountPickerView: UIPickerView! + + private var shouldDisplayPicker: Bool { + return accounts.count > 1 + } private var accounts: [Account]! @@ -25,10 +29,16 @@ class AddFolderViewController: UITableViewController, AddContainerViewController super.viewDidLoad() accounts = AccountManager.shared.sortedActiveAccounts + + nameTextField.delegate = self accountLabel.text = (accounts[0] as DisplayNameProvider).nameForDisplay - accountPickerView.dataSource = self - accountPickerView.delegate = self + if shouldDisplayPicker { + accountPickerView.dataSource = self + accountPickerView.delegate = self + } else { + accountPickerView.isHidden = true + } // I couldn't figure out the gap at the top of the UITableView, so I took a hammer to it. tableView.contentInset = UIEdgeInsets(top: -28, left: 0, bottom: 0, right: 0) @@ -53,6 +63,13 @@ class AddFolderViewController: UITableViewController, AddContainerViewController delegate?.readyToAdd(state: !(nameTextField.text?.isEmpty ?? false)) } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if section == 1 && !shouldDisplayPicker { + return 1 + } + + return super.tableView(tableView, numberOfRowsInSection: section) + } } extension AddFolderViewController: UIPickerViewDataSource, UIPickerViewDelegate { @@ -74,3 +91,12 @@ extension AddFolderViewController: UIPickerViewDataSource, UIPickerViewDelegate } } + +extension AddFolderViewController: UITextFieldDelegate { + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true + } + +} From 5280d1c75de418188a98d33e6ac6383c23c564bc Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 18:04:12 -0500 Subject: [PATCH 10/19] Made text size larger and fixed trailing margin for account name label --- iOS/Add/Add.storyboard | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iOS/Add/Add.storyboard b/iOS/Add/Add.storyboard index a758f7b38..a12af3b51 100644 --- a/iOS/Add/Add.storyboard +++ b/iOS/Add/Add.storyboard @@ -259,7 +259,7 @@ - + @@ -289,7 +289,7 @@ From 99010e8e3ebe763215deb1fc2833ab8f6c6dfbb2 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 18:13:10 -0500 Subject: [PATCH 11/19] Made text size larger and updated label margins to use standard value --- iOS/Add/Add.storyboard | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/iOS/Add/Add.storyboard b/iOS/Add/Add.storyboard index a12af3b51..f42b9d276 100644 --- a/iOS/Add/Add.storyboard +++ b/iOS/Add/Add.storyboard @@ -31,7 +31,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -77,26 +77,25 @@ - - - - - - - + + + + + + From 32d572307f1aaf5e0f3b1be726dac85b7854c338 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 18:19:03 -0500 Subject: [PATCH 12/19] Updated labels to use dynamic type --- iOS/Add/Add.storyboard | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/iOS/Add/Add.storyboard b/iOS/Add/Add.storyboard index f42b9d276..97404b6d9 100644 --- a/iOS/Add/Add.storyboard +++ b/iOS/Add/Add.storyboard @@ -28,10 +28,10 @@ - + - + @@ -50,10 +50,10 @@ - + - + @@ -76,15 +76,15 @@ - + + + + + + + + + + + - + @@ -153,7 +170,7 @@ - + @@ -183,7 +200,7 @@ - + @@ -211,7 +228,7 @@ - + @@ -234,23 +251,6 @@ - - - - - - - - - - - diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index f75601269..f395d62d1 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -58,6 +58,13 @@ class SettingsViewController: UITableViewController { switch section { case 0: return AccountManager.shared.accounts.count + 1 + case 1: + let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section) + if AccountManager.shared.activeAccounts.isEmpty { + // Hide the add NetNewsWire feed row if they don't have any active accounts + return defaultNumberOfRows - 1 + } + return defaultNumberOfRows default: return super.tableView(tableView, numberOfRowsInSection: section) } @@ -116,8 +123,12 @@ class SettingsViewController: UITableViewController { UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire")!, options: [:]) case 3: UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire/issues")!, options: [:]) - default: + case 4: UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")!, options: [:]) + case 5: + addFeed() + default: + UIApplication.shared.open(URL(string: "https://ranchero.com/netnewswire/")!, options: [:]) } case 2: UIApplication.shared.open(URL(string: "https://appcamp4girls.com/contribute/")!, options: [:]) @@ -132,10 +143,8 @@ class SettingsViewController: UITableViewController { let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self) self.navigationController?.pushViewController(timeline, animated: true) case 1: - addFeed() - case 2: importOPML() - case 3: + case 2: exportOPML() default: print("export") From 8c28160f917f26a059fd649c9b9b925e80c56acc Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 18:39:15 -0500 Subject: [PATCH 15/19] Always clear selection on viewWillAppear --- iOS/MasterFeed/MasterFeedViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 12a5380a9..5f828ba2f 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -49,7 +49,7 @@ class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunn } override func viewWillAppear(_ animated: Bool) { - clearsSelectionOnViewWillAppear = splitViewController!.isCollapsed + clearsSelectionOnViewWillAppear = true navigationController?.title = NSLocalizedString("Feeds", comment: "Feeds") super.viewWillAppear(animated) } From db3d8e484bf294ed3257780d4fc62058854c1b68 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 18:41:28 -0500 Subject: [PATCH 16/19] Made the preferred size wider --- iOS/Add/AddContainerViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/Add/AddContainerViewController.swift b/iOS/Add/AddContainerViewController.swift index ebd560c75..16d92719c 100644 --- a/iOS/Add/AddContainerViewController.swift +++ b/iOS/Add/AddContainerViewController.swift @@ -23,7 +23,7 @@ protocol AddContainerViewControllerChildDelegate: UIViewController { class AddContainerViewController: UIViewController { - static let preferredContentSizeForFormSheetDisplay = CGSize(width: 360.0, height: 400.0) + static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 400.0) @IBOutlet weak var cancelButton: UIBarButtonItem! @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! From 719fb5431136f692117077d9ddafe17c3daa1f1a Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 19:08:49 -0500 Subject: [PATCH 17/19] Allow delete account row to be tapped --- iOS/Settings/DetailAccountViewController.swift | 8 ++++++++ iOS/Settings/Settings.storyboard | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/iOS/Settings/DetailAccountViewController.swift b/iOS/Settings/DetailAccountViewController.swift index 4640671ab..9ab945120 100644 --- a/iOS/Settings/DetailAccountViewController.swift +++ b/iOS/Settings/DetailAccountViewController.swift @@ -51,6 +51,14 @@ extension DetailAccountViewController { return cell } + override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { + if indexPath.section == 1 { + return true + } + + return false + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 1 { deleteAccount() diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 435e042e1..7a67ec398 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -314,7 +314,7 @@ - + From 1271fc90815cda51b305b5250acbe22a5268d4c5 Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 19:18:28 -0500 Subject: [PATCH 18/19] Update UI when accounts change or when account state changes --- iOS/MasterFeed/MasterFeedViewController.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 5f828ba2f..cfb6fb1c2 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -36,7 +36,9 @@ class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunn NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: .UserDidAddFeed, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .AccountsDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(accountStateDidChange(_:)), name: .AccountStateDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(backingStoresDidRebuild(_:)), name: .BackingStoresDidRebuild, object: navState) NotificationCenter.default.addObserver(self, selector: #selector(masterSelectionDidChange(_:)), name: .MasterSelectionDidChange, object: navState) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) @@ -141,7 +143,15 @@ class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunn } } - + + @objc func accountsDidChange(_ notification: Notification) { + updateUI() + } + + @objc func accountStateDidChange(_ notification: Notification) { + updateUI() + } + @objc func masterSelectionDidChange(_ note: Notification) { if let indexPath = navState.currentMasterIndexPath { if tableView.indexPathForSelectedRow != indexPath { From 633e291c2ee67b787bee6107176623b8fb1773bf Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 19:20:35 -0500 Subject: [PATCH 19/19] Decrement the static row count instead of using hard-coded values --- iOS/Add/AddFeedViewController.swift | 7 ++++--- iOS/Add/AddFolderViewController.swift | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/iOS/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index fe3efe26f..b2b84cee0 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -126,11 +126,12 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if section == 1 { - return shouldDisplayPicker ? 2 : 1 + let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section) + if section == 1 && !shouldDisplayPicker { + return defaultNumberOfRows - 1 } - return super.tableView(tableView, numberOfRowsInSection: section) + return defaultNumberOfRows } diff --git a/iOS/Add/AddFolderViewController.swift b/iOS/Add/AddFolderViewController.swift index 3f2d9e6f1..3e7849937 100644 --- a/iOS/Add/AddFolderViewController.swift +++ b/iOS/Add/AddFolderViewController.swift @@ -64,11 +64,12 @@ class AddFolderViewController: UITableViewController, AddContainerViewController } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section) if section == 1 && !shouldDisplayPicker { - return 1 + return defaultNumberOfRows - 1 } - return super.tableView(tableView, numberOfRowsInSection: section) + return defaultNumberOfRows } }