diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index df20db9ac..994202c66 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -121,7 +121,7 @@ - + diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 7022f7a7f..65e6092a2 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -68,7 +68,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { override func viewWillAppear(_ animated: Bool) { navigationController?.title = NSLocalizedString("Feeds", comment: "Feeds") - clearsSelectionOnViewWillAppear = coordinator.isRootSplitCollapsed applyChanges(animate: false) super.viewWillAppear(animated) } @@ -451,7 +450,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { func restoreSelectionIfNecessary(adjustScroll: Bool) { if let indexPath = coordinator.masterFeedIndexPathForCurrentTimeline() { if adjustScroll { - tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed) + tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false) } else { tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none) } @@ -462,7 +461,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { if dataSource.snapshot().numberOfItems > 0 { if let indexPath = coordinator.currentFeedIndexPath { if tableView.indexPathForSelectedRow != indexPath { - tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed) + tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true) } } else { tableView.selectRow(at: nil, animated: true, scrollPosition: .none) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 8c74296ab..2dd9a9a2a 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -76,7 +76,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner } override func viewWillAppear(_ animated: Bool) { - clearsSelectionOnViewWillAppear = coordinator.isRootSplitCollapsed applyChanges(animate: false) super.viewWillAppear(animated) } @@ -132,7 +131,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner func restoreSelectionIfNecessary(adjustScroll: Bool) { if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) { if adjustScroll { - tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed) + tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false) } else { tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none) } @@ -150,7 +149,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner func updateArticleSelection(animated: Bool) { if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) { if tableView.indexPathForSelectedRow != indexPath { - tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed) + tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true) } } else { tableView.selectRow(at: nil, animated: animated, scrollPosition: .none) diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index ab57d6523..e97a63e19 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -950,6 +950,7 @@ extension SceneCoordinator: UINavigationControllerDelegate { if viewController === masterTimelineViewController && !isThreePanelMode && rootSplitViewController.isCollapsed && !isArticleViewControllerPending { stopArticleExtractor() currentArticle = nil + masterTimelineViewController?.updateArticleSelection(animated: animated) activityManager.invalidateReading() return } diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 5079063cf..617b76467 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -9,7 +9,7 @@ - + diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 0c268ac1d..b88d37246 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -29,7 +29,10 @@ class SettingsViewController: UITableViewController { // This hack mostly works around a bug in static tables with dynamic type. See: https://spin.atomicobject.com/2018/10/15/dynamic-type-static-uitableview/ NotificationCenter.default.removeObserver(tableView!, name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) - + + NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange), name: .UserDidAddAccount, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange), name: .UserDidDeleteAccount, object: nil) + tableView.register(UINib(nibName: "SettingsTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsTableViewCell") } @@ -63,8 +66,11 @@ class SettingsViewController: UITableViewController { buildLabel.translatesAutoresizingMaskIntoConstraints = false tableView.tableFooterView = buildLabel - tableView.reloadData() - + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + self.tableView.selectRow(at: nil, animated: true, scrollPosition: .none) } // MARK: UITableView @@ -112,6 +118,7 @@ class SettingsViewController: UITableViewController { switch indexPath.section { case 0: UIApplication.shared.open(URL(string: "\(UIApplication.openSettingsURLString)")!) + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 1: let sortedAccounts = AccountManager.shared.sortedAccounts if indexPath.row == sortedAccounts.count { @@ -128,11 +135,13 @@ class SettingsViewController: UITableViewController { let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self) self.navigationController?.pushViewController(timeline, animated: true) case 1: + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) if let sourceView = tableView.cellForRow(at: indexPath) { let sourceRect = tableView.rectForRow(at: indexPath) importOPML(sourceView: sourceView, sourceRect: sourceRect) } case 2: + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) if let sourceView = tableView.cellForRow(at: indexPath) { let sourceRect = tableView.rectForRow(at: indexPath) exportOPML(sourceView: sourceView, sourceRect: sourceRect) @@ -147,24 +156,28 @@ class SettingsViewController: UITableViewController { self.navigationController?.pushViewController(timeline, animated: true) case 1: openURL("https://ranchero.com/netnewswire/") + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 2: openURL("https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown") + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 3: openURL("https://github.com/brentsimmons/NetNewsWire") + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 4: openURL("https://github.com/brentsimmons/NetNewsWire/issues") + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 5: openURL("https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes") + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 6: addFeed() + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) default: break } default: - break + tableView.selectRow(at: nil, animated: true, scrollPosition: .none) } - - tableView.selectRow(at: nil, animated: true, scrollPosition: .none) } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { @@ -223,10 +236,16 @@ class SettingsViewController: UITableViewController { updateNumberOfTextLinesLabel(value: numberOfLines) } + // MARK: Notifications + @objc func contentSizeCategoryDidChange() { tableView.reloadData() } + @objc func accountsDidChange() { + tableView.reloadData() + } + } // MARK: OPML Document Picker diff --git a/submodules/RSCore b/submodules/RSCore index 29dc34284..fa16a5b1a 160000 --- a/submodules/RSCore +++ b/submodules/RSCore @@ -1 +1 @@ -Subproject commit 29dc34284b64af4a399d1cf3927c3469851ec0ad +Subproject commit fa16a5b1a0bc45bb6aee6145e1095446a84f386b