mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Fix bug where sidebar unread count view would flicker as the timeline view controller unreadCount would be briefly 0 when it’s updating its unread count.
This commit is contained in:
parent
16b2e55f5f
commit
9a26df89d1
@ -815,14 +815,18 @@ 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 nodeShouldGetUnreadCountFromTimeline(node) {
|
|
||||||
return delegate?.unreadCount(for: node.representedObject) ?? 0
|
var count = 0
|
||||||
|
if let unreadCountProvider = node.representedObject as? UnreadCountProvider {
|
||||||
|
count = unreadCountProvider.unreadCount
|
||||||
}
|
}
|
||||||
|
|
||||||
if let unreadCountProvider = node.representedObject as? UnreadCountProvider {
|
if nodeShouldGetUnreadCountFromTimeline(node) {
|
||||||
return unreadCountProvider.unreadCount
|
let timelineUnreadCount = delegate?.unreadCount(for: node.representedObject) ?? 0
|
||||||
|
return max(count, timelineUnreadCount) // timelineUnreadCount may include additional transients
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
func nodeShouldGetUnreadCountFromTimeline(_ node: Node) -> Bool {
|
func nodeShouldGetUnreadCountFromTimeline(_ node: Node) -> Bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user