From ac19ea47a4ddd1f3451e3daf7e2d79f23dc430e3 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 2 Nov 2025 15:57:33 -0800 Subject: [PATCH] Rename some instances of webfeed as feed. --- .../Timeline/ArticlePasteboardWriter.swift | 4 ++-- .../Timeline/TimelineViewController.swift | 2 +- Modules/Account/Sources/Account/Account.swift | 10 +++++----- .../Account/CloudKit/CloudKitArticlesZone.swift | 6 +++--- .../Account/Sources/Account/DataExtensions.swift | 4 ++-- .../AccountTests/Feedly/FeedlyTestSupport.swift | 2 +- Modules/Articles/Sources/Articles/Article.swift | 14 +++++++------- .../Sources/ArticlesDatabase/ArticlesTable.swift | 4 ++-- .../Extensions/Article+Database.swift | 10 +++++----- .../Extensions/ParsedArticle+Database.swift | 2 +- Shared/Activity/ActivityManager.swift | 4 ++-- Shared/Extensions/ArticleUtilities.swift | 6 +++--- Tests/NetNewsWireTests/SharingTests.swift | 2 +- iOS/SceneCoordinator.swift | 2 +- ...dernTimelineCustomizerTableViewController.swift | 2 +- 15 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift index 1cffc3e19..52aa89b2c 100644 --- a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift +++ b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift @@ -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 diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index d95833e6d..6480d50ab 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -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) diff --git a/Modules/Account/Sources/Account/Account.swift b/Modules/Account/Sources/Account/Account.swift index c3c0c2495..ee0ed476e 100644 --- a/Modules/Account/Sources/Account/Account.swift +++ b/Modules/Account/Sources/Account/Account.swift @@ -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
) { - 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() 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 diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift index c3e68a423..2c5600fc7 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitArticlesZone.swift @@ -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 diff --git a/Modules/Account/Sources/Account/DataExtensions.swift b/Modules/Account/Sources/Account/DataExtensions.swift index dfc6cc9f0..e9a244941 100644 --- a/Modules/Account/Sources/Account/DataExtensions.swift +++ b/Modules/Account/Sources/Account/DataExtensions.swift @@ -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) } } diff --git a/Modules/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift b/Modules/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift index fb557d4fd..026e048c3 100644 --- a/Modules/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift +++ b/Modules/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift @@ -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) } } diff --git a/Modules/Articles/Sources/Articles/Article.swift b/Modules/Articles/Sources/Articles/Article.swift index 89787fda8..30ec95d2f 100644 --- a/Modules/Articles/Sources/Articles/Article.swift +++ b/Modules/Articles/Sources/Articles/Article.swift @@ -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? 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?, 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?, 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 } } diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift index bace3643c..154b067cf 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift @@ -131,7 +131,7 @@ final class ArticlesTable: DatabaseTable { func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set) throws -> Set
{ 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, _ database: FMDatabase) -> Set
{ 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, _ database: FMDatabase) -> Set
{ diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/Article+Database.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/Article+Database.swift index e94a8969d..f5e581416 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/Article+Database.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/Article+Database.swift @@ -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, _ 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 { diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/ParsedArticle+Database.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/ParsedArticle+Database.swift index e59539d11..271876057 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/ParsedArticle+Database.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/Extensions/ParsedArticle+Database.swift @@ -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) } } diff --git a/Shared/Activity/ActivityManager.swift b/Shared/Activity/ActivityManager.swift index 2d82b265e..c380b8405 100644 --- a/Shared/Activity/ActivityManager.swift +++ b/Shared/Activity/ActivityManager.swift @@ -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] { diff --git a/Shared/Extensions/ArticleUtilities.swift b/Shared/Extensions/ArticleUtilities.swift index c0858661d..1caa6cb5d 100644 --- a/Shared/Extensions/ArticleUtilities.swift +++ b/Shared/Extensions/ArticleUtilities.swift @@ -43,7 +43,7 @@ private func accountAndArticlesDictionary(_ articles: Set
) -> [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 } } diff --git a/Tests/NetNewsWireTests/SharingTests.swift b/Tests/NetNewsWireTests/SharingTests.swift index 886974961..371838462 100644 --- a/Tests/NetNewsWireTests/SharingTests.swift +++ b/Tests/NetNewsWireTests/SharingTests.swift @@ -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, diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index f5e331578..490318496 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -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) } } diff --git a/iOS/Settings/ModernTimelineCustomizerTableViewController.swift b/iOS/Settings/ModernTimelineCustomizerTableViewController.swift index 193a68771..a76320a9e 100644 --- a/iOS/Settings/ModernTimelineCustomizerTableViewController.swift +++ b/iOS/Settings/ModernTimelineCustomizerTableViewController.swift @@ -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,