mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 09:50:16 +00:00
Use dataSource instead of tree model, since dataSource is source of truth for the UI.
This commit is contained in:
1 parent
f93ac4ffdb
commit
19dffd34a8
1 file changed
+12
-12
@@ -641,18 +641,18 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
return
|
||||
}
|
||||
|
||||
let node: Node? = coordinator.rootNode.descendantNodeRepresentingObject(unreadCountProvider as AnyObject)
|
||||
|
||||
guard let unreadCountNode = node, let indexPath = coordinator.indexPathFor(unreadCountNode) else {
|
||||
return
|
||||
}
|
||||
|
||||
if let cell = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewCell {
|
||||
cell.unreadCount = unreadCountProvider.unreadCount
|
||||
}
|
||||
|
||||
if let cell = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewFolderCell {
|
||||
cell.unreadCount = unreadCountProvider.unreadCount
|
||||
for cell in collectionView.visibleCells {
|
||||
guard let indexPath = collectionView.indexPath(for: cell),
|
||||
let sidebarItemNode = dataSource.itemIdentifier(for: indexPath),
|
||||
sidebarItemNode.node.representedObject === unreadCountProvider as AnyObject else {
|
||||
continue
|
||||
}
|
||||
if let feedCell = cell as? MainFeedCollectionViewCell {
|
||||
feedCell.unreadCount = unreadCountProvider.unreadCount
|
||||
}
|
||||
if let folderCell = cell as? MainFeedCollectionViewFolderCell {
|
||||
folderCell.unreadCount = unreadCountProvider.unreadCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user