mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-29 19:11:24 +01:00
Include updated feeds in StatusesDidChange notification, so that updating unread counts will work.
This commit is contained in:
parent
6572631866
commit
77042f67b5
@ -39,7 +39,9 @@ public final class Account: DisplayNameProvider, Container, Hashable {
|
||||
public struct UserInfoKey {
|
||||
public static let newArticles = "newArticles" // AccountDidDownloadArticles
|
||||
public static let updatedArticles = "updatedArticles" // AccountDidDownloadArticles
|
||||
public static let statuses = "statuses" // ArticleStatusesDidChange
|
||||
public static let statuses = "statuses" // StatusesDidChange
|
||||
public static let articles = "articles" // StatusesDidChange
|
||||
public static let feeds = "feeds" // StatusesDidChange
|
||||
}
|
||||
|
||||
public let accountID: String
|
||||
@ -157,7 +159,12 @@ public final class Account: DisplayNameProvider, Container, Hashable {
|
||||
public func markArticles(_ articles: Set<Article>, statusKey: ArticleStatus.Key, flag: Bool) {
|
||||
|
||||
if let updatedStatuses = database.mark(articles, statusKey: statusKey, flag: flag) {
|
||||
NotificationCenter.default.post(name: .StatusesDidChange, object: self, userInfo: [UserInfoKey.statuses: updatedStatuses])
|
||||
|
||||
let updatedArticleIDs = updatedStatuses.articleIDs()
|
||||
let updatedArticles = Set(articles.filter{ updatedArticleIDs.contains($0.articleID) })
|
||||
let updatedFeeds = Set(articles.flatMap{ $0.feed })
|
||||
|
||||
NotificationCenter.default.post(name: .StatusesDidChange, object: self, userInfo: [UserInfoKey.statuses: updatedStatuses, UserInfoKey.articles: updatedArticles, UserInfoKey.feeds: updatedFeeds])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,15 @@ public extension Feed {
|
||||
|
||||
public extension Article {
|
||||
|
||||
var account: Account? {
|
||||
public var account: Account? {
|
||||
get {
|
||||
return AccountManager.shared.existingAccount(with: accountID)
|
||||
}
|
||||
}
|
||||
|
||||
public var feed: Feed? {
|
||||
get {
|
||||
return account?.existingFeed(with: feedID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user