Make Article a class.
This commit is contained in:
parent
ef4104e7fa
commit
75a56be4d6
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue