Show No Selection system message when selection is cleared by returning to the Feeds list

This commit is contained in:
Maurice Parker 2019-07-19 12:29:17 -05:00
parent 11d74372b1
commit a47e4cab77
1 changed files with 20 additions and 1 deletions

View File

@ -21,7 +21,7 @@ public extension Notification.Name {
static let ArticleSelectionDidChange = Notification.Name(rawValue: "ArticleSelectionDidChange") static let ArticleSelectionDidChange = Notification.Name(rawValue: "ArticleSelectionDidChange")
} }
class AppCoordinator: UndoableCommandRunner { class AppCoordinator: NSObject, UndoableCommandRunner {
var undoableCommands = [UndoableCommand]() var undoableCommands = [UndoableCommand]()
var undoManager: UndoManager? { var undoManager: UndoManager? {
@ -184,6 +184,8 @@ class AppCoordinator: UndoableCommandRunner {
init(_ rootSplitViewController: UISplitViewController) { init(_ rootSplitViewController: UISplitViewController) {
super.init()
for section in treeController.rootNode.childNodes { for section in treeController.rootNode.childNodes {
expandedNodes.append(section) expandedNodes.append(section)
shadowTable.append([Node]()) shadowTable.append([Node]())
@ -204,6 +206,7 @@ class AppCoordinator: UndoableCommandRunner {
rootSplitViewController.delegate = self rootSplitViewController.delegate = self
masterNavigationController = (rootSplitViewController.viewControllers.first as! UINavigationController) masterNavigationController = (rootSplitViewController.viewControllers.first as! UINavigationController)
masterNavigationController.delegate = self
masterFeedViewController = (masterNavigationController.topViewController as! MasterFeedViewController) masterFeedViewController = (masterNavigationController.topViewController as! MasterFeedViewController)
masterFeedViewController.coordinator = self masterFeedViewController.coordinator = self
@ -564,6 +567,22 @@ class AppCoordinator: UndoableCommandRunner {
} }
// MARK: UINavigationControllerDelegate
extension AppCoordinator: UINavigationControllerDelegate {
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
if navigationController.viewControllers.count == 1 {
let systemMessageNavController = UIStoryboard.main.instantiateViewController(identifier: "SystemMessageNavigationController") as! UINavigationController
let systemMessageViewController = systemMessageNavController.topViewController as! SystemMessageViewController
systemMessageViewController.navigationItem.leftBarButtonItem = rootSplitViewController.displayModeButtonItem
systemMessageViewController.navigationItem.leftItemsSupplementBackButton = true
rootSplitViewController.showDetailViewController(systemMessageNavController, sender: self)
}
}
}
// MARK: UISplitViewControllerDelegate // MARK: UISplitViewControllerDelegate
extension AppCoordinator: UISplitViewControllerDelegate { extension AppCoordinator: UISplitViewControllerDelegate {