 import Account
 
 protocol SmartFeedDelegate: DisplayNameProvider, ArticleFetcher {
-
 	func fetchUnreadCount(for: Account, callback: @escaping (Int) -> Void)
 }
 

	}

	func updateUnreadCount() {

		unreadCount = AccountManager.shared.accounts.reduce(0) { (result, account) -> Int in
			if let oneUnreadCount = unreadCounts[account] {
				return result + oneUnreadCount

	private var unreadCounts = [Account: Int]()

	init(delegate: SmartFeedDelegate) {
		self.delegate = delegate
		NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
		queueFetchUnreadCounts() // Fetch unread count at startup
	}

	@objc func unreadCountDidChange(_ note: Notification) {
		if note.object is Account {
			queueFetchUnreadCounts()
		}
	}

	@objc func fetchUnreadCounts() {
		AccountManager.shared.accounts.forEach { self.fetchUnreadCount(for: $0) }
	}
}
