Merge branch 'mac-candidate'
This commit is contained in:
commit
7b3c08f521
@ -83,7 +83,12 @@ protocol SidebarDelegate: class {
|
|||||||
guard let representedObject = note.object else {
|
guard let representedObject = note.object else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
configureUnreadCountForCellsForRepresentedObject(representedObject as AnyObject)
|
if let timelineViewController = representedObject as? TimelineViewController {
|
||||||
|
configureUnreadCountForCellsForRepresentedObjects(timelineViewController.representedObjects)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
configureUnreadCountForCellsForRepresentedObjects([representedObject as AnyObject])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func containerChildrenDidChange(_ note: Notification) {
|
@objc func containerChildrenDidChange(_ note: Notification) {
|
||||||
@ -502,7 +507,7 @@ private extension SidebarViewController {
|
|||||||
// then the unread count comes from the timeline.
|
// then the unread count comes from the timeline.
|
||||||
// This ensures that any transients in the timeline
|
// This ensures that any transients in the timeline
|
||||||
// are accounted for in the unread count.
|
// are accounted for in the unread count.
|
||||||
if selectedNodes.count == 1 && node === selectedNodes.first! {
|
if nodeShouldGetUnreadCountFromTimeline(node) {
|
||||||
return delegate?.unreadCount(for: node.representedObject) ?? 0
|
return delegate?.unreadCount(for: node.representedObject) ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,6 +517,18 @@ private extension SidebarViewController {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nodeShouldGetUnreadCountFromTimeline(_ node: Node) -> Bool {
|
||||||
|
// Only if it’s selected and it’s the only node selected.
|
||||||
|
return selectedNodes.count == 1 && selectedNodes.first! === node
|
||||||
|
}
|
||||||
|
|
||||||
|
func nodeRepresentsTodayFeed(_ node: Node) -> Bool {
|
||||||
|
guard let smartFeed = node.representedObject as? SmartFeed else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return smartFeed === SmartFeedsController.shared.todayFeed
|
||||||
|
}
|
||||||
|
|
||||||
func cellForRowView(_ rowView: NSTableRowView) -> SidebarCell? {
|
func cellForRowView(_ rowView: NSTableRowView) -> SidebarCell? {
|
||||||
return rowView.view(atColumn: 0) as? SidebarCell
|
return rowView.view(atColumn: 0) as? SidebarCell
|
||||||
}
|
}
|
||||||
@ -537,8 +554,13 @@ private extension SidebarViewController {
|
|||||||
applyToCellsForRepresentedObject(representedObject, configure)
|
applyToCellsForRepresentedObject(representedObject, configure)
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureUnreadCountForCellsForRepresentedObject(_ representedObject: AnyObject) {
|
func configureUnreadCountForCellsForRepresentedObjects(_ representedObjects: [AnyObject]?) {
|
||||||
applyToCellsForRepresentedObject(representedObject, configureUnreadCount)
|
guard let representedObjects = representedObjects else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for object in representedObjects {
|
||||||
|
applyToCellsForRepresentedObject(object, configureUnreadCount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
|
Loading…
x
Reference in New Issue
Block a user