Only clear Feed/Timeline selection after view begins to appear. Issue #1156
This commit is contained in:
parent
b0881f47fc
commit
7b51a272b0
@ -121,7 +121,7 @@
|
|||||||
<!--Timeline-->
|
<!--Timeline-->
|
||||||
<scene sceneID="fag-XH-avP">
|
<scene sceneID="fag-XH-avP">
|
||||||
<objects>
|
<objects>
|
||||||
<tableViewController storyboardIdentifier="MasterTimelineViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Kyk-vK-QRX" customClass="MasterTimelineViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
<tableViewController storyboardIdentifier="MasterTimelineViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="Kyk-vK-QRX" customClass="MasterTimelineViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="mtv-Ik-FoJ">
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="mtv-Ik-FoJ">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
@ -68,7 +68,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
navigationController?.title = NSLocalizedString("Feeds", comment: "Feeds")
|
navigationController?.title = NSLocalizedString("Feeds", comment: "Feeds")
|
||||||
clearsSelectionOnViewWillAppear = coordinator.isRootSplitCollapsed
|
|
||||||
applyChanges(animate: false)
|
applyChanges(animate: false)
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
}
|
}
|
||||||
@ -451,7 +450,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
func restoreSelectionIfNecessary(adjustScroll: Bool) {
|
func restoreSelectionIfNecessary(adjustScroll: Bool) {
|
||||||
if let indexPath = coordinator.masterFeedIndexPathForCurrentTimeline() {
|
if let indexPath = coordinator.masterFeedIndexPathForCurrentTimeline() {
|
||||||
if adjustScroll {
|
if adjustScroll {
|
||||||
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
|
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false)
|
||||||
} else {
|
} else {
|
||||||
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
|
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
|
||||||
}
|
}
|
||||||
@ -462,7 +461,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
if dataSource.snapshot().numberOfItems > 0 {
|
if dataSource.snapshot().numberOfItems > 0 {
|
||||||
if let indexPath = coordinator.currentFeedIndexPath {
|
if let indexPath = coordinator.currentFeedIndexPath {
|
||||||
if tableView.indexPathForSelectedRow != indexPath {
|
if tableView.indexPathForSelectedRow != indexPath {
|
||||||
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
|
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
|
@ -76,7 +76,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
clearsSelectionOnViewWillAppear = coordinator.isRootSplitCollapsed
|
|
||||||
applyChanges(animate: false)
|
applyChanges(animate: false)
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
}
|
}
|
||||||
@ -132,7 +131,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||||||
func restoreSelectionIfNecessary(adjustScroll: Bool) {
|
func restoreSelectionIfNecessary(adjustScroll: Bool) {
|
||||||
if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) {
|
if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) {
|
||||||
if adjustScroll {
|
if adjustScroll {
|
||||||
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
|
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false)
|
||||||
} else {
|
} else {
|
||||||
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
|
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
|
||||||
}
|
}
|
||||||
@ -150,7 +149,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||||||
func updateArticleSelection(animated: Bool) {
|
func updateArticleSelection(animated: Bool) {
|
||||||
if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) {
|
if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) {
|
||||||
if tableView.indexPathForSelectedRow != indexPath {
|
if tableView.indexPathForSelectedRow != indexPath {
|
||||||
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
|
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tableView.selectRow(at: nil, animated: animated, scrollPosition: .none)
|
tableView.selectRow(at: nil, animated: animated, scrollPosition: .none)
|
||||||
|
@ -950,6 +950,7 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
|||||||
if viewController === masterTimelineViewController && !isThreePanelMode && rootSplitViewController.isCollapsed && !isArticleViewControllerPending {
|
if viewController === masterTimelineViewController && !isThreePanelMode && rootSplitViewController.isCollapsed && !isArticleViewControllerPending {
|
||||||
stopArticleExtractor()
|
stopArticleExtractor()
|
||||||
currentArticle = nil
|
currentArticle = nil
|
||||||
|
masterTimelineViewController?.updateArticleSelection(animated: animated)
|
||||||
activityManager.invalidateReading()
|
activityManager.invalidateReading()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<!--Settings-->
|
<!--Settings-->
|
||||||
<scene sceneID="gUB-2F-Iar">
|
<scene sceneID="gUB-2F-Iar">
|
||||||
<objects>
|
<objects>
|
||||||
<tableViewController storyboardIdentifier="SettingsViewController" id="a0p-rk-skQ" customClass="SettingsViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
<tableViewController storyboardIdentifier="SettingsViewController" clearsSelectionOnViewWillAppear="NO" id="a0p-rk-skQ" customClass="SettingsViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" sectionFooterHeight="18" id="Wxa-ac-xiE">
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" sectionFooterHeight="18" id="Wxa-ac-xiE">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
@ -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/
|
// 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.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(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")
|
tableView.register(UINib(nibName: "SettingsTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsTableViewCell")
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -63,8 +66,11 @@ class SettingsViewController: UITableViewController {
|
|||||||
buildLabel.translatesAutoresizingMaskIntoConstraints = false
|
buildLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||||
tableView.tableFooterView = buildLabel
|
tableView.tableFooterView = buildLabel
|
||||||
|
|
||||||
tableView.reloadData()
|
}
|
||||||
|
|
||||||
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
super.viewDidAppear(animated)
|
||||||
|
self.tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UITableView
|
// MARK: UITableView
|
||||||
@ -112,6 +118,7 @@ class SettingsViewController: UITableViewController {
|
|||||||
switch indexPath.section {
|
switch indexPath.section {
|
||||||
case 0:
|
case 0:
|
||||||
UIApplication.shared.open(URL(string: "\(UIApplication.openSettingsURLString)")!)
|
UIApplication.shared.open(URL(string: "\(UIApplication.openSettingsURLString)")!)
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 1:
|
case 1:
|
||||||
let sortedAccounts = AccountManager.shared.sortedAccounts
|
let sortedAccounts = AccountManager.shared.sortedAccounts
|
||||||
if indexPath.row == sortedAccounts.count {
|
if indexPath.row == sortedAccounts.count {
|
||||||
@ -128,11 +135,13 @@ class SettingsViewController: UITableViewController {
|
|||||||
let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self)
|
let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self)
|
||||||
self.navigationController?.pushViewController(timeline, animated: true)
|
self.navigationController?.pushViewController(timeline, animated: true)
|
||||||
case 1:
|
case 1:
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
if let sourceView = tableView.cellForRow(at: indexPath) {
|
if let sourceView = tableView.cellForRow(at: indexPath) {
|
||||||
let sourceRect = tableView.rectForRow(at: indexPath)
|
let sourceRect = tableView.rectForRow(at: indexPath)
|
||||||
importOPML(sourceView: sourceView, sourceRect: sourceRect)
|
importOPML(sourceView: sourceView, sourceRect: sourceRect)
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
if let sourceView = tableView.cellForRow(at: indexPath) {
|
if let sourceView = tableView.cellForRow(at: indexPath) {
|
||||||
let sourceRect = tableView.rectForRow(at: indexPath)
|
let sourceRect = tableView.rectForRow(at: indexPath)
|
||||||
exportOPML(sourceView: sourceView, sourceRect: sourceRect)
|
exportOPML(sourceView: sourceView, sourceRect: sourceRect)
|
||||||
@ -147,24 +156,28 @@ class SettingsViewController: UITableViewController {
|
|||||||
self.navigationController?.pushViewController(timeline, animated: true)
|
self.navigationController?.pushViewController(timeline, animated: true)
|
||||||
case 1:
|
case 1:
|
||||||
openURL("https://ranchero.com/netnewswire/")
|
openURL("https://ranchero.com/netnewswire/")
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 2:
|
case 2:
|
||||||
openURL("https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown")
|
openURL("https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown")
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 3:
|
case 3:
|
||||||
openURL("https://github.com/brentsimmons/NetNewsWire")
|
openURL("https://github.com/brentsimmons/NetNewsWire")
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 4:
|
case 4:
|
||||||
openURL("https://github.com/brentsimmons/NetNewsWire/issues")
|
openURL("https://github.com/brentsimmons/NetNewsWire/issues")
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 5:
|
case 5:
|
||||||
openURL("https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")
|
openURL("https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
case 6:
|
case 6:
|
||||||
addFeed()
|
addFeed()
|
||||||
|
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:
|
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 {
|
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||||
@ -223,10 +236,16 @@ class SettingsViewController: UITableViewController {
|
|||||||
updateNumberOfTextLinesLabel(value: numberOfLines)
|
updateNumberOfTextLinesLabel(value: numberOfLines)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: Notifications
|
||||||
|
|
||||||
@objc func contentSizeCategoryDidChange() {
|
@objc func contentSizeCategoryDidChange() {
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func accountsDidChange() {
|
||||||
|
tableView.reloadData()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: OPML Document Picker
|
// MARK: OPML Document Picker
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 29dc34284b64af4a399d1cf3927c3469851ec0ad
|
Subproject commit fa16a5b1a0bc45bb6aee6145e1095446a84f386b
|
Loading…
x
Reference in New Issue
Block a user