mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Get the unread count from the timeline for the currently selected node in the sidebar. This ensures that transients in the timeline are accounted for. (The database query for the unread count wouldn’t necessarily match.)
This commit is contained in:
@@ -387,6 +387,16 @@ extension MainWindowController: SidebarDelegate {
|
||||
updateWindowTitle()
|
||||
NotificationCenter.default.post(name: .InspectableObjectsDidChange, object: nil)
|
||||
}
|
||||
|
||||
func unreadCount(for representedObject: AnyObject) -> Int {
|
||||
guard let timelineViewController = regularTimelineViewController else {
|
||||
return 0
|
||||
}
|
||||
guard timelineViewController.representsThisObjectOnly(representedObject) else {
|
||||
return 0
|
||||
}
|
||||
return timelineViewController.unreadCount
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TimelineContainerViewControllerDelegate
|
||||
@@ -545,6 +555,10 @@ private extension MainWindowController {
|
||||
return timelineContainerViewController?.currentTimelineViewController
|
||||
}
|
||||
|
||||
var regularTimelineViewController: TimelineViewController? {
|
||||
return timelineContainerViewController?.regularTimelineViewController
|
||||
}
|
||||
|
||||
var sidebarSplitViewItem: NSSplitViewItem? {
|
||||
return splitViewController?.splitViewItems[0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user