Make Article a class.

This commit is contained in:
Brent Simmons 2024-11-10 21:45:16 -08:00
parent ef4104e7fa
commit 75a56be4d6
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import Foundation
public typealias ArticleSetBlock = (Set<Article>) -> Void public typealias ArticleSetBlock = (Set<Article>) -> Void
public struct Article: Hashable { public final class Article: Hashable {
public let articleID: String // Unique database ID (possibly sync service ID) public let articleID: String // Unique database ID (possibly sync service ID)
public let accountID: String public let accountID: String

View File

@ -14,7 +14,7 @@ import RSParser
extension Article { extension Article {
init?(accountID: String, row: FMResultSet, status: ArticleStatus) { convenience init?(accountID: String, row: FMResultSet, status: ArticleStatus) {
guard let articleID = row.string(forColumn: DatabaseKey.articleID) else { guard let articleID = row.string(forColumn: DatabaseKey.articleID) else {
assertionFailure("Expected articleID.") assertionFailure("Expected articleID.")
return nil return nil
@ -41,7 +41,7 @@ extension Article {
self.init(accountID: accountID, articleID: articleID, feedID: feedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, datePublished: datePublished, dateModified: dateModified, authors: nil, status: status) self.init(accountID: accountID, articleID: articleID, feedID: feedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, datePublished: datePublished, dateModified: dateModified, authors: nil, status: status)
} }
init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, feedID: String, status: ArticleStatus) { convenience init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, feedID: String, status: ArticleStatus) {
let authors = Author.authorsWithParsedAuthors(parsedItem.authors) let authors = Author.authorsWithParsedAuthors(parsedItem.authors)
// Deal with future datePublished and dateModified dates. // Deal with future datePublished and dateModified dates.