Remove references to the no-longer-used TimelineSelectionDidChange notification.

This commit is contained in:
Brent Simmons 2019-02-18 14:54:38 -08:00
parent f2d98c9581
commit 74b3ecdab8
2 changed files with 4 additions and 20 deletions

View File

@ -10,7 +10,6 @@ import AppKit
import Articles import Articles
extension Notification.Name { extension Notification.Name {
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")
static let UserDidRequestSidebarSelection = Notification.Name("UserDidRequestSidebarSelectionNotification") static let UserDidRequestSidebarSelection = Notification.Name("UserDidRequestSidebarSelectionNotification")

View File

@ -35,7 +35,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner {
showFeedNames = false showFeedNames = false
} }
postTimelineSelectionDidChangeNotification(nil) selectionDidChange(nil)
fetchArticles() fetchArticles()
if articles.count > 0 { if articles.count > 0 {
tableView.scrollRowToVisible(0) tableView.scrollRowToVisible(0)
@ -633,9 +633,8 @@ extension TimelineViewController: NSTableViewDelegate {
} }
func tableViewSelectionDidChange(_ notification: Notification) { func tableViewSelectionDidChange(_ notification: Notification) {
if selectedArticles.isEmpty { if selectedArticles.isEmpty {
postTimelineSelectionDidChangeNotification(nil) selectionDidChange(nil)
return return
} }
@ -646,30 +645,18 @@ extension TimelineViewController: NSTableViewDelegate {
} }
} }
postTimelineSelectionDidChangeNotification(selectedArticles) selectionDidChange(selectedArticles)
self.invalidateRestorableState() self.invalidateRestorableState()
} }
private func postTimelineSelectionDidChangeNotification(_ selectedArticles: ArticleArray?) { private func selectionDidChange(_ selectedArticles: ArticleArray?) {
delegate?.timelineSelectionDidChange(self, selectedArticles: selectedArticles) delegate?.timelineSelectionDidChange(self, selectedArticles: selectedArticles)
var userInfo = UserInfoDictionary()
if let selectedArticles = selectedArticles {
userInfo[UserInfoKey.articles] = selectedArticles
}
userInfo[UserInfoKey.view] = tableView
NotificationCenter.default.post(name: .TimelineSelectionDidChange, object: self, userInfo: userInfo)
} }
private func configureTimelineCell(_ cell: TimelineTableCellView, article: Article) { private func configureTimelineCell(_ cell: TimelineTableCellView, article: Article) {
cell.objectValue = article cell.objectValue = article
// let favicon = showFeedNames ? article.feed?.smallIcon : nil
var avatar = avatarFor(article) var avatar = avatarFor(article)
if avatar == nil, let feed = article.feed { if avatar == nil, let feed = article.feed {
avatar = appDelegate.faviconDownloader.favicon(for: feed) avatar = appDelegate.faviconDownloader.favicon(for: feed)
@ -680,7 +667,6 @@ extension TimelineViewController: NSTableViewDelegate {
} }
private func avatarFor(_ article: Article) -> NSImage? { private func avatarFor(_ article: Article) -> NSImage? {
if !showAvatars { if !showAvatars {
return nil return nil
} }
@ -700,7 +686,6 @@ extension TimelineViewController: NSTableViewDelegate {
} }
private func avatarForAuthor(_ author: Author) -> NSImage? { private func avatarForAuthor(_ author: Author) -> NSImage? {
return appDelegate.authorAvatarDownloader.image(for: author) return appDelegate.authorAvatarDownloader.image(for: author)
} }