Rename some instances of webfeed as feed.

This commit is contained in:
Brent Simmons committed 2025-11-02 15:57:33 -08:00
1 parent 3936e01d81
commit ac19ea47a4
15 files changed
+37 -37

No files matched your search

@@ -111,7 +111,7 @@ private extension ArticlePasteboardWriter {
static let articleID = "articleID" // database ID, unique per account
static let uniqueID = "uniqueID" // unique ID, unique per feed (guid, or possibly calculated)
static let feedURL = "feedURL"
static let webFeedID = "webFeedID" // may differ from feedURL if coming from a syncing system
static let feedID = "feedID" // may differ from feedURL if coming from a syncing system
static let title = "title"
static let contentHTML = "contentHTML"
static let contentText = "contentText"
@@ -147,7 +147,7 @@ private extension ArticlePasteboardWriter {
d[Key.feedURL] = feed.url
}
d[Key.webFeedID] = article.webFeedID
d[Key.feedID] = article.feedID
d[Key.title] = article.title ?? nil
d[Key.contentHTML] = article.contentHTML ?? nil
d[Key.contentText] = article.contentText ?? nil
@@ -761,7 +761,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
let longTitle = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
let prototypeID = "prototype"
let status = ArticleStatus(articleID: prototypeID, read: false, starred: false, dateArrived: Date())
let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, webFeedID: prototypeID, uniqueID: prototypeID, title: longTitle, contentHTML: nil, contentText: nil, markdown: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status)
let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, feedID: prototypeID, uniqueID: prototypeID, title: longTitle, contentHTML: nil, contentText: nil, markdown: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status)
let prototypeCellData = TimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Prototype Feed Name", byline: nil, iconImage: nil, showIcon: false)
let height = TimelineCellLayout.height(for: 100, cellData: prototypeCellData, appearance: cellAppearance)
@@ -1166,7 +1166,7 @@ private extension Account {
var unreadCountStorage = [String: Int]() // [WebFeedID: Int]
for article in articles where !article.status.read {
unreadCountStorage[article.webFeedID, default: 0] += 1
unreadCountStorage[article.feedID, default: 0] += 1
}
webFeeds.forEach { (webFeed) in
let unreadCount = unreadCountStorage[webFeed.webFeedID, default: 0]
@@ -1179,7 +1179,7 @@ private extension Account {
// The unread number should match the feed’s unread count.
let feedUnreadCount = articles.reduce(0) { (result, article) -> Int in
if article.webFeed == feed && !article.status.read {
if article.feed == feed && !article.status.read {
return result + 1
}
return result
@@ -1243,7 +1243,7 @@ private extension Account {
}
func noteStatusesForArticlesDidChange(_ articles: Set<Article>) {
let feeds = Set(articles.compactMap { $0.webFeed })
let feeds = Set(articles.compactMap { $0.feed })
let statuses = Set(articles.map { $0.status })
let articleIDs = Set(articles.map { $0.articleID })
@@ -1334,10 +1334,10 @@ private extension Account {
var webFeeds = Set<Feed>()
if let newArticles = articleChanges.newArticles {
webFeeds.formUnion(Set(newArticles.compactMap { $0.webFeed }))
webFeeds.formUnion(Set(newArticles.compactMap { $0.feed }))
}
if let updatedArticles = articleChanges.updatedArticles {
webFeeds.formUnion(Set(updatedArticles.compactMap { $0.webFeed }))
webFeeds.formUnion(Set(updatedArticles.compactMap { $0.feed }))
}
var shouldSendNotification = false
@@ -188,7 +188,7 @@ private extension CloudKitArticlesZone {
func makeStatusRecord(_ article: Article) -> CKRecord {
let recordID = CKRecord.ID(recordName: statusID(article.articleID), zoneID: zoneID)
let record = CKRecord(recordType: CloudKitArticleStatus.recordType, recordID: recordID)
if let webFeedExternalID = article.webFeed?.externalID {
if let webFeedExternalID = article.feed?.externalID {
record[CloudKitArticleStatus.Fields.webFeedExternalID] = webFeedExternalID
}
record[CloudKitArticleStatus.Fields.read] = article.status.read ? "1" : "0"
@@ -200,7 +200,7 @@ private extension CloudKitArticlesZone {
let recordID = CKRecord.ID(recordName: statusID(statusUpdate.articleID), zoneID: zoneID)
let record = CKRecord(recordType: CloudKitArticleStatus.recordType, recordID: recordID)
if let webFeedExternalID = statusUpdate.article?.webFeed?.externalID {
if let webFeedExternalID = statusUpdate.article?.feed?.externalID {
record[CloudKitArticleStatus.Fields.webFeedExternalID] = webFeedExternalID
}
@@ -216,7 +216,7 @@ private extension CloudKitArticlesZone {
let articleStatusRecordID = CKRecord.ID(recordName: statusID(article.articleID), zoneID: zoneID)
record[CloudKitArticle.Fields.articleStatus] = CKRecord.Reference(recordID: articleStatusRecordID, action: .deleteSelf)
record[CloudKitArticle.Fields.webFeedURL] = article.webFeed?.url
record[CloudKitArticle.Fields.webFeedURL] = article.feed?.url
record[CloudKitArticle.Fields.uniqueID] = article.uniqueID
record[CloudKitArticle.Fields.title] = article.title
record[CloudKitArticle.Fields.contentHTML] = article.contentHTML
@@ -57,8 +57,8 @@ public extension Article {
return manager.existingAccount(with: accountID)
}
var webFeed: Feed? {
return account?.existingWebFeed(withWebFeedID: webFeedID)
var feed: Feed? {
return account?.existingWebFeed(withWebFeedID: feedID)
}
}
@@ -210,7 +210,7 @@ final class FeedlyTestSupport {
for item in articleItems where item.id == article.articleID {
XCTAssertEqual(article.uniqueID, item.id)
XCTAssertEqual(article.contentHTML, item.content)
XCTAssertEqual(article.webFeedID, item.feedId)
XCTAssertEqual(article.feedID, item.feedId)
XCTAssertEqual(article.rawExternalLink, item.externalUrl)
}
}
@@ -14,7 +14,7 @@ public final class Article: Hashable {
public let articleID: String // Unique database ID (possibly sync service ID)
public let accountID: String
public let webFeedID: String // Likely a URL, but not necessarily
public let feedID: String // Likely a URL, but not necessarily
public let uniqueID: String // Unique per feed (RSS guid, for example)
public let title: String?
public let contentHTML: String?
@@ -29,9 +29,9 @@ public final class Article: Hashable {
public let authors: Set<Author>?
public let status: ArticleStatus
public init(accountID: String, articleID: String?, webFeedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, markdown: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, datePublished: Date?, dateModified: Date?, authors: Set<Author>?, status: ArticleStatus) {
public init(accountID: String, articleID: String?, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, markdown: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, datePublished: Date?, dateModified: Date?, authors: Set<Author>?, status: ArticleStatus) {
self.accountID = accountID
self.webFeedID = webFeedID
self.feedID = feedID
self.uniqueID = uniqueID
self.title = title
self.contentHTML = contentHTML
@@ -50,12 +50,12 @@ public final class Article: Hashable {
self.articleID = articleID
}
else {
self.articleID = Article.calculatedArticleID(webFeedID: webFeedID, uniqueID: uniqueID)
self.articleID = Article.calculatedArticleID(feedID: feedID, uniqueID: uniqueID)
}
}
public static func calculatedArticleID(webFeedID: String, uniqueID: String) -> String {
return databaseIDWithString("\(webFeedID) \(uniqueID)")
public static func calculatedArticleID(feedID: String, uniqueID: String) -> String {
return databaseIDWithString("\(feedID) \(uniqueID)")
}
// MARK: - Hashable
@@ -67,7 +67,7 @@ public final class Article: Hashable {
// MARK: - Equatable
static public func ==(lhs: Article, rhs: Article) -> Bool {
return lhs.articleID == rhs.articleID && lhs.accountID == rhs.accountID && lhs.webFeedID == rhs.webFeedID && lhs.uniqueID == rhs.uniqueID && lhs.title == rhs.title && lhs.contentHTML == rhs.contentHTML && lhs.contentText == rhs.contentText && lhs.rawLink == rhs.rawLink && lhs.rawExternalLink == rhs.rawExternalLink && lhs.summary == rhs.summary && lhs.rawImageLink == rhs.rawImageLink && lhs.datePublished == rhs.datePublished && lhs.dateModified == rhs.dateModified && lhs.authors == rhs.authors
return lhs.articleID == rhs.articleID && lhs.accountID == rhs.accountID && lhs.feedID == rhs.feedID && lhs.uniqueID == rhs.uniqueID && lhs.title == rhs.title && lhs.contentHTML == rhs.contentHTML && lhs.contentText == rhs.contentText && lhs.rawLink == rhs.rawLink && lhs.rawExternalLink == rhs.rawExternalLink && lhs.summary == rhs.summary && lhs.rawImageLink == rhs.rawImageLink && lhs.datePublished == rhs.datePublished && lhs.dateModified == rhs.dateModified && lhs.authors == rhs.authors
}
}
@@ -131,7 +131,7 @@ final class ArticlesTable: DatabaseTable {
func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set<String>) throws -> Set<Article> {
var articles = try fetchArticlesMatching(searchString)
articles = articles.filter{ webFeedIDs.contains($0.webFeedID) }
articles = articles.filter{ webFeedIDs.contains($0.feedID) }
return articles
}
@@ -903,7 +903,7 @@ private extension ArticlesTable {
func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
let articles = fetchArticlesMatching(searchString, database)
// TODO: include the feedIDs in the SQL rather than filtering here.
return articles.filter{ webFeedIDs.contains($0.webFeedID) }
return articles.filter{ webFeedIDs.contains($0.feedID) }
}
func fetchArticlesMatchingWithArticleIDs(_ searchString: String, _ articleIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
@@ -19,7 +19,7 @@ extension Article {
assertionFailure("Expected articleID.")
return nil
}
guard let webFeedID = row.string(forColumn: DatabaseKey.feedID) else {
guard let feedID = row.string(forColumn: DatabaseKey.feedID) else {
assertionFailure("Expected feedID.")
return nil
}
@@ -39,7 +39,7 @@ extension Article {
let datePublished = row.date(forColumn: DatabaseKey.datePublished)
let dateModified = row.date(forColumn: DatabaseKey.dateModified)
self.init(accountID: accountID, articleID: articleID, webFeedID: webFeedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, markdown: markdown, 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, markdown: markdown, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, datePublished: datePublished, dateModified: dateModified, authors: nil, status: status)
}
convenience init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, webFeedID: String, status: ArticleStatus) {
@@ -59,7 +59,7 @@ extension Article {
dateModified = nil
}
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, webFeedID: webFeedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, markdown: parsedItem.markdown, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, datePublished: datePublished, dateModified: dateModified, authors: authors, status: status)
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, feedID: webFeedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, markdown: parsedItem.markdown, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, datePublished: datePublished, dateModified: dateModified, authors: authors, status: status)
}
private func addPossibleStringChangeWithKeyPath(_ comparisonKeyPath: KeyPath<Article,String?>, _ otherArticle: Article, _ key: String, _ dictionary: inout DatabaseDictionary) {
@@ -72,7 +72,7 @@ extension Article {
if authors.isEmpty {
return self
}
return Article(accountID: self.accountID, articleID: self.articleID, webFeedID: self.webFeedID, uniqueID: self.uniqueID, title: self.title, contentHTML: self.contentHTML, contentText: self.contentText, markdown: self.markdown, url: self.rawLink, externalURL: self.rawExternalLink, summary: self.summary, imageURL: self.rawImageLink, datePublished: self.datePublished, dateModified: self.dateModified, authors: authors, status: self.status)
return Article(accountID: self.accountID, articleID: self.articleID, feedID: self.feedID, uniqueID: self.uniqueID, title: self.title, contentHTML: self.contentHTML, contentText: self.contentText, markdown: self.markdown, url: self.rawLink, externalURL: self.rawExternalLink, summary: self.summary, imageURL: self.rawImageLink, datePublished: self.datePublished, dateModified: self.dateModified, authors: authors, status: self.status)
}
func changesFrom(_ existingArticle: Article) -> DatabaseDictionary? {
@@ -143,7 +143,7 @@ extension Article: @retroactive DatabaseObject {
var d = DatabaseDictionary()
d[DatabaseKey.articleID] = articleID
d[DatabaseKey.feedID] = webFeedID
d[DatabaseKey.feedID] = feedID
d[DatabaseKey.uniqueID] = uniqueID
if let title = title {
@@ -17,6 +17,6 @@ extension ParsedItem {
return s
}
// Must be same calculation as for Article.
return Article.calculatedArticleID(webFeedID: feedURL, uniqueID: uniqueID)
return Article.calculatedArticleID(feedID: feedURL, uniqueID: uniqueID)
}
}
+2 -2
View File
@@ -146,7 +146,7 @@ final class ActivityManager {
}
#if os(iOS)
if let article = readingArticle, activityFeedId == article.webFeedID {
if let article = readingArticle, activityFeedId == article.feedID {
updateReadArticleSearchAttributes(with: article)
}
#endif
@@ -283,7 +283,7 @@ private extension ActivityManager {
}
static func identifier(for article: Article) -> String {
return "account_\(article.accountID)_feed_\(article.webFeedID)_article_\(article.articleID)"
return "account_\(article.accountID)_feed_\(article.feedID)_article_\(article.articleID)"
}
static func identifiers(for feed: Feed) -> [String] {
+3 -3
View File
@@ -43,7 +43,7 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
extension Article {
var feed: Feed? {
return account?.existingWebFeed(withWebFeedID: webFeedID)
return account?.existingWebFeed(withWebFeedID: feedID)
}
var url: URL? {
@@ -199,7 +199,7 @@ extension Article {
return [
ArticlePathKey.accountID: accountID,
ArticlePathKey.accountName: account?.nameForDisplay ?? "",
ArticlePathKey.webFeedID: webFeedID,
ArticlePathKey.webFeedID: feedID,
ArticlePathKey.articleID: articleID
]
}
@@ -223,7 +223,7 @@ extension Article: SortableArticle {
}
var sortableWebFeedID: String {
return webFeedID
return feedID
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ final class SharingTests: XCTestCase {
let articleId = randomId()
return Article(accountID: randomId(),
articleID: articleId,
webFeedID: randomId(),
feedID: randomId(),
uniqueID: randomId(),
title: title,
contentHTML: nil,
+1 -1
View File
@@ -2043,7 +2043,7 @@ private extension SceneCoordinator {
if !unsortedArticleIDs.contains(article.articleID) {
updatedArticles.insert(article)
}
if article.account?.existingWebFeed(withWebFeedID: article.webFeedID) == nil {
if article.account?.existingWebFeed(withWebFeedID: article.feedID) == nil {
updatedArticles.remove(article)
}
}
@@ -23,7 +23,7 @@ class ModernTimelineCustomizerTableViewController: UITableViewController {
return Article(accountID: "_testID",
articleID: "_testArticleID",
webFeedID: "_testWebFeedID",
feedID: "_testFeedID",
uniqueID: UUID().uuidString,
title: "Chapter 1",
contentHTML: nil,