Avoid looking for favicon when updating only a cell’s unread count. Micro-optimization.

This commit is contained in:
Brent Simmons 2017-11-25 15:21:35 -08:00
parent 5e41460849
commit 7b964e05f9
1 changed files with 16 additions and 1 deletions

View File

@ -63,7 +63,7 @@ import RSCore
guard let representedObject = note.object else { guard let representedObject = note.object else {
return return
} }
configureCellsForRepresentedObject(representedObject as AnyObject) configureUnreadCountForCellsForRepresentedObject(representedObject as AnyObject)
} }
@objc dynamic func containerChildrenDidChange(_ note: Notification) { @objc dynamic func containerChildrenDidChange(_ note: Notification) {
@ -343,6 +343,11 @@ private extension SidebarViewController {
cell.shouldShowImage = node.representedObject is Feed cell.shouldShowImage = node.representedObject is Feed
} }
func configureUnreadCount(_ cell: SidebarCell, _ node: Node) {
cell.unreadCount = unreadCountFor(node)
}
func configureGroupCell(_ cell: NSTableCellView, _ node: Node) { func configureGroupCell(_ cell: NSTableCellView, _ node: Node) {
cell.objectValue = node cell.objectValue = node
@ -435,6 +440,16 @@ private extension SidebarViewController {
return true return true
} }
func configureUnreadCountForCellsForRepresentedObject(_ representedObject: AnyObject) {
cellsForRepresentedObject(representedObject).forEach { (cell) in
guard let node = cell.objectValue as? Node else {
return
}
configureUnreadCount(cell, node)
}
}
@discardableResult @discardableResult
func revealAndSelectRepresentedObject(_ representedObject: AnyObject) -> Bool { func revealAndSelectRepresentedObject(_ representedObject: AnyObject) -> Bool {