From 2574e1bbd71c6661ca88f12b348d3c76e5e85e6b Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 17 Feb 2019 18:52:34 -0800 Subject: [PATCH] Remove references to the SidebarSelectionDidChange notification. --- NetNewsWire/AppNotifications.swift | 1 - .../MainWindow/MainWindowController.swift | 1 - .../Sidebar/SidebarViewController.swift | 14 +++----------- .../Timeline/TimelineViewController.swift | 18 ------------------ 4 files changed, 3 insertions(+), 31 deletions(-) diff --git a/NetNewsWire/AppNotifications.swift b/NetNewsWire/AppNotifications.swift index 2752f6ee0..107e2befc 100644 --- a/NetNewsWire/AppNotifications.swift +++ b/NetNewsWire/AppNotifications.swift @@ -10,7 +10,6 @@ import AppKit import Articles extension Notification.Name { - static let SidebarSelectionDidChange = Notification.Name("SidebarSelectionDidChangeNotification") static let TimelineSelectionDidChange = Notification.Name("TimelineSelectionDidChangeNotification") static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification") static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification") diff --git a/NetNewsWire/MainWindow/MainWindowController.swift b/NetNewsWire/MainWindow/MainWindowController.swift index 657f4160a..9c6fa7183 100644 --- a/NetNewsWire/MainWindow/MainWindowController.swift +++ b/NetNewsWire/MainWindow/MainWindowController.swift @@ -73,7 +73,6 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshDidFinish, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil) -// NotificationCenter.default.addObserver(self, selector: #selector(sidebarSelectionDidChange(_:)), name: .SidebarSelectionDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) diff --git a/NetNewsWire/MainWindow/Sidebar/SidebarViewController.swift b/NetNewsWire/MainWindow/Sidebar/SidebarViewController.swift index b71a08c8b..8fc8ec3d5 100644 --- a/NetNewsWire/MainWindow/Sidebar/SidebarViewController.swift +++ b/NetNewsWire/MainWindow/Sidebar/SidebarViewController.swift @@ -282,8 +282,7 @@ protocol SidebarDelegate: class { } func outlineViewSelectionDidChange(_ notification: Notification) { - - postSidebarSelectionDidChangeNotification(selectedObjects.isEmpty ? nil : selectedObjects) + selectionDidChange(selectedObjects.isEmpty ? nil : selectedObjects) } //MARK: - Node Manipulation @@ -381,19 +380,12 @@ private extension SidebarViewController { outlineView.selectRowIndexes(indexes, byExtendingSelection: false) if selectedNodes != nodes && sendNotificationIfChanged { - postSidebarSelectionDidChangeNotification(selectedObjects) + selectionDidChange(selectedObjects) } } - func postSidebarSelectionDidChangeNotification(_ selectedObjects: [AnyObject]?) { + func selectionDidChange(_ selectedObjects: [AnyObject]?) { delegate?.selectionDidChange(to: selectedObjects) -// var userInfo = UserInfoDictionary() -// if let objects = selectedObjects { -// userInfo[UserInfoKey.objects] = objects -// } -// userInfo[UserInfoKey.view] = outlineView -// -// NotificationCenter.default.post(name: .SidebarSelectionDidChange, object: self, userInfo: userInfo) } func updateUnreadCounts(for objects: [AnyObject]) { diff --git a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift index f555c392b..8994e595a 100644 --- a/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift +++ b/NetNewsWire/MainWindow/Timeline/TimelineViewController.swift @@ -147,7 +147,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner { if !didRegisterForNotifications { -// NotificationCenter.default.addObserver(self, selector: #selector(sidebarSelectionDidChange(_:)), name: .SidebarSelectionDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) @@ -372,23 +371,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner { // MARK: - Notifications -// @objc func sidebarSelectionDidChange(_ notification: Notification) { -// -// guard let userInfo = notification.userInfo else { -// return -// } -// guard let sidebarView = userInfo[UserInfoKey.view] as? NSView, sidebarView.window === tableView.window else { -// return -// } -// -// if let objects = userInfo[UserInfoKey.objects] as? [AnyObject] { -// representedObjects = objects -// } -// else { -// representedObjects = nil -// } -// } - @objc func statusesDidChange(_ note: Notification) { guard let articles = note.userInfo?[Account.UserInfoKey.articles] as? Set
else {