mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Add method for fetching a single article (for state restoration).
This commit is contained in:
1 parent
3af0c4a222
commit
ec9ba9555d
1 file changed
+16
@@ -390,6 +390,22 @@ import RSDatabase
|
||||
return allFetchedArticles
|
||||
}
|
||||
|
||||
/// Fetch a single article (synchronously) by accountID and articleID.
|
||||
public func fetchArticle(accountID: String, articleID: String) -> Article? {
|
||||
precondition(Thread.isMainThread)
|
||||
|
||||
guard let account = existingAccount(accountID: accountID) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
do {
|
||||
let articles = try account.fetchArticles(.articleIDs(Set([articleID])))
|
||||
return articles.first
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Fetching Article Counts
|
||||
|
||||
@MainActor public func fetchCountForStarredArticles() throws -> Int {
|
||||
|
||||
Reference in new issue
Block a user