Remove references to the SidebarSelectionDidChange notification.

This commit is contained in:
Brent Simmons 2019-02-17 18:52:34 -08:00
parent 9a15068fdd
commit 2574e1bbd7
4 changed files with 3 additions and 31 deletions

View File

@ -10,7 +10,6 @@ import AppKit
import Articles import Articles
extension Notification.Name { extension Notification.Name {
static let SidebarSelectionDidChange = Notification.Name("SidebarSelectionDidChangeNotification")
static let TimelineSelectionDidChange = Notification.Name("TimelineSelectionDidChangeNotification") static let TimelineSelectionDidChange = Notification.Name("TimelineSelectionDidChangeNotification")
static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification") static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification")
static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification") static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification")

View File

@ -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: .AccountRefreshDidFinish, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .AccountRefreshProgressDidChange, 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(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)

View File

@ -282,8 +282,7 @@ protocol SidebarDelegate: class {
} }
func outlineViewSelectionDidChange(_ notification: Notification) { func outlineViewSelectionDidChange(_ notification: Notification) {
selectionDidChange(selectedObjects.isEmpty ? nil : selectedObjects)
postSidebarSelectionDidChangeNotification(selectedObjects.isEmpty ? nil : selectedObjects)
} }
//MARK: - Node Manipulation //MARK: - Node Manipulation
@ -381,19 +380,12 @@ private extension SidebarViewController {
outlineView.selectRowIndexes(indexes, byExtendingSelection: false) outlineView.selectRowIndexes(indexes, byExtendingSelection: false)
if selectedNodes != nodes && sendNotificationIfChanged { if selectedNodes != nodes && sendNotificationIfChanged {
postSidebarSelectionDidChangeNotification(selectedObjects) selectionDidChange(selectedObjects)
} }
} }
func postSidebarSelectionDidChangeNotification(_ selectedObjects: [AnyObject]?) { func selectionDidChange(_ selectedObjects: [AnyObject]?) {
delegate?.selectionDidChange(to: selectedObjects) 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]) { func updateUnreadCounts(for objects: [AnyObject]) {

View File

@ -147,7 +147,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner {
if !didRegisterForNotifications { 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(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil)
@ -372,23 +371,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner {
// MARK: - Notifications // 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) { @objc func statusesDidChange(_ note: Notification) {
guard let articles = note.userInfo?[Account.UserInfoKey.articles] as? Set<Article> else { guard let articles = note.userInfo?[Account.UserInfoKey.articles] as? Set<Article> else {