Add method for fetching a single article (for state restoration).

This commit is contained in:
Brent Simmons committed 2025-12-04 20:32:18 -08:00
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 {