Restore feed selection after initial layout so that the visible area tests are correct.

This commit is contained in:
Maurice Parker
2019-11-29 17:36:22 -06:00
parent 4288e71887
commit 1f924a80fa
2 changed files with 16 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
return keyboardManager.keyCommands
}
var restoreSelection = false
override var canBecomeFirstResponder: Bool {
return true
}
@@ -75,6 +76,17 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
super.viewWillAppear(animated)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
// We have to delay the selection of the Feed until the subviews have been layed out
// so that the visible area is correct and we scroll correctly.
if restoreSelection {
restoreSelectionIfNecessary(adjustScroll: true)
restoreSelection = false
}
}
// MARK: Notifications
@objc func unreadCountDidChange(_ note: Notification) {

View File

@@ -1829,7 +1829,9 @@ private extension SceneCoordinator {
}
treeControllerDelegate.addFilterException(feedIdentifier)
masterFeedViewController.restoreSelection = true
switch feedIdentifier {
case .smartFeed:
@@ -1902,6 +1904,8 @@ private extension SceneCoordinator {
return false
}
masterFeedViewController.restoreSelection = true
switch feedIdentifier {
case .smartFeed: