From 37c332554d80b74f3d2c54924d3cd84a2760ab09 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 2 Nov 2025 15:12:00 -0800 Subject: [PATCH] Rename article.webFeed to article.feed. --- Mac/MainWindow/MainWindowController.swift | 4 ++-- .../Timeline/ArticlePasteboardWriter.swift | 4 ++-- .../TimelineViewController+ContextualMenus.swift | 2 +- Mac/MainWindow/Timeline/TimelineViewController.swift | 4 ++-- Mac/Scriptability/Article+Scriptability.swift | 2 +- Mac/Scriptability/NSApplication+Scriptability.swift | 6 +++--- Shared/Activity/ActivityManager.swift | 2 +- Shared/Article Rendering/ArticleRenderer.swift | 12 ++++++------ Shared/ExtensionPoints/SendToMarsEditCommand.swift | 2 +- Shared/ExtensionPoints/SendToMicroBlogCommand.swift | 4 ++-- Shared/Extensions/ArticleUtilities.swift | 8 ++++---- Shared/IconImageCache.swift | 2 +- .../UserNotifications/UserNotificationManager.swift | 2 +- iOS/Article/ContextMenuPreviewViewController.swift | 2 +- iOS/Article/WebViewController.swift | 4 ++-- iOS/MainTimeline/MainTimelineViewController.swift | 12 ++++++------ iOS/SceneCoordinator.swift | 2 +- 17 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index c909bf10b..d666f827b 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -611,7 +611,7 @@ extension MainWindowController: TimelineContainerViewControllerDelegate { if let articles = articles { if articles.count == 1 { activityManager.reading(feed: nil, article: articles.first) - if articles.first?.webFeed?.isArticleExtractorAlwaysOn ?? false { + if articles.first?.feed?.isArticleExtractorAlwaysOn ?? false { detailState = .loading startArticleExtractorForCurrentLink() } else { @@ -1124,7 +1124,7 @@ private extension MainWindowController { return currentLink != nil } - if currentTimelineViewController?.selectedArticles.first?.webFeed != nil { + if currentTimelineViewController?.selectedArticles.first?.feed != nil { toolbarButton.isEnabled = true } diff --git a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift index 29be01571..1cffc3e19 100644 --- a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift +++ b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift @@ -96,7 +96,7 @@ private extension ArticlePasteboardWriter { s += "Date: \(article.logicalDatePublished)\n\n" - if let feed = article.webFeed { + if let feed = article.feed { s += "Feed: \(feed.nameForDisplay)\n" if let homePageURL = feed.homePageURL { s += "Home page: \(homePageURL)\n" @@ -143,7 +143,7 @@ private extension ArticlePasteboardWriter { d[Key.articleID] = article.articleID d[Key.uniqueID] = article.uniqueID - if let feed = article.webFeed { + if let feed = article.feed { d[Key.feedURL] = feed.url } diff --git a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift index fd0fadddb..6f145d469 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift @@ -171,7 +171,7 @@ private extension TimelineViewController { menu.addSeparatorIfNeeded() - if articles.count == 1, let feed = articles.first!.webFeed { + if articles.count == 1, let feed = articles.first!.feed { if !(representedObjects?.contains(where: { $0 as? Feed == feed }) ?? false) { menu.addItem(selectFeedInSidebarMenuItem(feed)) } diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 1c63bfcb1..a9a87926a 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -636,7 +636,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr guard let article = articles.articleAtRow(row) else { return false } - return feed == article.webFeed + return feed == article.feed } if let indexesToReload = indexesToReload { reloadCells(for: indexesToReload) @@ -922,7 +922,7 @@ extension TimelineViewController: NSTableViewDelegate { private func configureTimelineCell(_ cell: TimelineTableCellView, article: Article) { cell.objectValue = article let iconImage = article.iconImage() - cell.cellData = TimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.webFeed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcons) + cell.cellData = TimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.feed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcons) } private func iconFor(_ article: Article) -> IconImage? { diff --git a/Mac/Scriptability/Article+Scriptability.swift b/Mac/Scriptability/Article+Scriptability.swift index aa1c516cd..58fb03088 100644 --- a/Mac/Scriptability/Article+Scriptability.swift +++ b/Mac/Scriptability/Article+Scriptability.swift @@ -143,7 +143,7 @@ final class ScriptableArticle: NSObject, UniqueIdScriptingObject, ScriptingObjec @objc(feed) var feed: ScriptableWebFeed? { - guard let parentFeed = self.article.webFeed else { return nil } + guard let parentFeed = self.article.feed else { return nil } return ScriptableWebFeed.scriptableWebFeed(for: parentFeed) } } diff --git a/Mac/Scriptability/NSApplication+Scriptability.swift b/Mac/Scriptability/NSApplication+Scriptability.swift index 1b879979b..8e80b2fb4 100644 --- a/Mac/Scriptability/NSApplication+Scriptability.swift +++ b/Mac/Scriptability/NSApplication+Scriptability.swift @@ -30,7 +30,7 @@ extension NSApplication : ScriptingObjectContainer { func currentArticle() -> ScriptableArticle? { var scriptableArticle: ScriptableArticle? if let currentArticle = appDelegate.scriptingCurrentArticle { - if let feed = currentArticle.webFeed, + if let feed = currentArticle.feed, let scriptableFeed = ScriptableWebFeed.scriptableWebFeed(for: feed) { scriptableArticle = ScriptableArticle(currentArticle, container: scriptableFeed) } @@ -42,7 +42,7 @@ extension NSApplication : ScriptingObjectContainer { func selectedArticles() -> NSArray { let articles = appDelegate.scriptingSelectedArticles let scriptableArticles:[ScriptableArticle] = articles.compactMap { article in - if let feed = article.webFeed, + if let feed = article.feed, let scriptableFeed = ScriptableWebFeed.scriptableWebFeed(for: feed) { return ScriptableArticle(article, container:scriptableFeed) } else { @@ -63,7 +63,7 @@ extension NSApplication : ScriptingObjectContainer { guard index >= 0 && index < articles.count else { return nil } let article = articles[index] - if let feed = article.webFeed, + if let feed = article.feed, let scriptableFeed = ScriptableWebFeed.scriptableWebFeed(for: feed) { return ScriptableArticle(article, container: scriptableFeed) } else { diff --git a/Shared/Activity/ActivityManager.swift b/Shared/Activity/ActivityManager.swift index 55acbea09..9c0cbf861 100644 --- a/Shared/Activity/ActivityManager.swift +++ b/Shared/Activity/ActivityManager.swift @@ -236,7 +236,7 @@ private extension ActivityManager { #endif func makeKeywords(_ article: Article) -> [String] { - let feedNameKeywords = makeKeywords(article.webFeed?.nameForDisplay) + let feedNameKeywords = makeKeywords(article.feed?.nameForDisplay) let articleTitleKeywords = makeKeywords(ArticleStringFormatter.truncatedTitle(article)) return feedNameKeywords + articleTitleKeywords } diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index 58f8c938d..9513a8fc9 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -241,8 +241,8 @@ private extension ArticleRenderer { d["dateline_style"] = "articleDateline" } - d["feed_link_title"] = article.webFeed?.nameForDisplay ?? "" - d["feed_link"] = article.webFeed?.homePageURL ?? "" + d["feed_link_title"] = article.feed?.nameForDisplay ?? "" + d["feed_link"] = article.feed?.homePageURL ?? "" d["byline"] = byline() @@ -261,7 +261,7 @@ private extension ArticleRenderer { } func byline() -> String { - guard let authors = article?.authors ?? article?.webFeed?.authors, !authors.isEmpty else { + guard let authors = article?.authors ?? article?.feed?.authors, !authors.isEmpty else { return "" } @@ -269,7 +269,7 @@ private extension ArticleRenderer { // This code assumes that multiple authors would never match the feed name so that // if there feed owner has an article co-author all authors are given the byline. if authors.count == 1, let author = authors.first { - if author.name == article?.webFeed?.nameForDisplay { + if author.name == article?.feed?.nameForDisplay { return "" } } @@ -333,10 +333,10 @@ private extension Article { var baseURL: URL? { var s = link if s == nil { - s = webFeed?.homePageURL + s = feed?.homePageURL } if s == nil { - s = webFeed?.url + s = feed?.url } guard let urlString = s else { diff --git a/Shared/ExtensionPoints/SendToMarsEditCommand.swift b/Shared/ExtensionPoints/SendToMarsEditCommand.swift index 484398a87..49576b1c7 100644 --- a/Shared/ExtensionPoints/SendToMarsEditCommand.swift +++ b/Shared/ExtensionPoints/SendToMarsEditCommand.swift @@ -56,7 +56,7 @@ private extension SendToMarsEditCommand { let body = article.contentHTML ?? article.contentText ?? article.summary let authorName = article.authors?.first?.name - let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.webFeed?.nameForDisplay, sourceHomeURL: article.webFeed?.homePageURL, sourceFeedURL: article.webFeed?.url) + let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.feed?.nameForDisplay, sourceHomeURL: article.feed?.homePageURL, sourceFeedURL: article.feed?.url) let _ = sender.send() } diff --git a/Shared/ExtensionPoints/SendToMicroBlogCommand.swift b/Shared/ExtensionPoints/SendToMicroBlogCommand.swift index 4d6fe3bd7..342bec319 100644 --- a/Shared/ExtensionPoints/SendToMicroBlogCommand.swift +++ b/Shared/ExtensionPoints/SendToMicroBlogCommand.swift @@ -68,10 +68,10 @@ private extension Article { // Feed name, or feed name + author name (if author is specified per-article). // Includes trailing space. - if let feedName = webFeed?.nameForDisplay, let authorName = authors?.first?.name { + if let feedName = feed?.nameForDisplay, let authorName = authors?.first?.name { return feedName + ", " + authorName + ": " } - if let feedName = webFeed?.nameForDisplay { + if let feedName = feed?.nameForDisplay { return feedName + ": " } return "" diff --git a/Shared/Extensions/ArticleUtilities.swift b/Shared/Extensions/ArticleUtilities.swift index 221339aa5..c0858661d 100644 --- a/Shared/Extensions/ArticleUtilities.swift +++ b/Shared/Extensions/ArticleUtilities.swift @@ -42,7 +42,7 @@ private func accountAndArticlesDictionary(_ articles: Set
) -> [String: extension Article { - var webFeed: Feed? { + var feed: Feed? { return account?.existingWebFeed(withWebFeedID: webFeedID) } @@ -135,7 +135,7 @@ extension Article { } func byline() -> String { - guard let authors = authors ?? webFeed?.authors, !authors.isEmpty else { + guard let authors = authors ?? feed?.authors, !authors.isEmpty else { return "" } @@ -143,7 +143,7 @@ extension Article { // This code assumes that multiple authors would never match the feed name so that // if there feed owner has an article co-author all authors are given the byline. if authors.count == 1, let author = authors.first { - if author.name == webFeed?.nameForDisplay { + if author.name == feed?.nameForDisplay { return "" } } @@ -211,7 +211,7 @@ extension Article { extension Article: SortableArticle { var sortableName: String { - return webFeed?.name ?? "" + return feed?.name ?? "" } var sortableDate: Date { diff --git a/Shared/IconImageCache.swift b/Shared/IconImageCache.swift index 0ea3aaa96..8a2721020 100644 --- a/Shared/IconImageCache.swift +++ b/Shared/IconImageCache.swift @@ -52,7 +52,7 @@ final class IconImageCache { if let iconImage = imageForAuthors(article.authors) { return iconImage } - guard let feed = article.webFeed else { + guard let feed = article.feed else { return nil } return imageForFeed(feed) diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index c72f07668..59a3b6299 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -26,7 +26,7 @@ final class UserNotificationManager: NSObject { } for article in articles { - if !article.status.read, let webFeed = article.webFeed, webFeed.isNotifyAboutNewArticles ?? false { + if !article.status.read, let webFeed = article.feed, webFeed.isNotifyAboutNewArticles ?? false { sendNotification(webFeed: webFeed, article: article) } } diff --git a/iOS/Article/ContextMenuPreviewViewController.swift b/iOS/Article/ContextMenuPreviewViewController.swift index 345bfed2d..6752220f2 100644 --- a/iOS/Article/ContextMenuPreviewViewController.swift +++ b/iOS/Article/ContextMenuPreviewViewController.swift @@ -21,7 +21,7 @@ final class ContextMenuPreviewViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - blogNameLabel.text = article.webFeed?.nameForDisplay ?? "" + blogNameLabel.text = article.feed?.nameForDisplay ?? "" blogAuthorLabel.text = article.byline() articleTitleLabel.text = article.title ?? "" diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 92544b873..66f145b4b 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -114,7 +114,7 @@ final class WebViewController: UIViewController { if article != self.article { self.article = article if updateView { - if article?.webFeed?.isArticleExtractorAlwaysOn ?? false { + if article?.feed?.isArticleExtractorAlwaysOn ?? false { startArticleExtractor() } windowScrollY = 0 @@ -451,7 +451,7 @@ extension WebViewController: WKScriptMessageHandler { case MessageName.imageWasClicked: imageWasClicked(body: message.body as? String) case MessageName.showFeedInspector: - if let webFeed = article?.webFeed { + if let webFeed = article?.feed { coordinator.showFeedInspector(for: webFeed) } default: diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index fe69a3aa1..3a69119dc 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -619,7 +619,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu guard let article = dataSource.itemIdentifier(for: indexPath) else { return } - if article.webFeed == feed { + if article.feed == feed { if let cell = tableView.cellForRow(at: indexPath) as? MainTimelineIconFeedCell, let image = iconImageFor(article) { cell.setIconImage(image) } @@ -834,7 +834,7 @@ private extension MainTimelineViewController { let iconImage = iconImageFor(article) let showFeedNames = coordinator?.showFeedNames ?? ShowFeedName.none let showIcon = showIcons && iconImage != nil - let cellData = MainTimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.webFeed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcon, numberOfLines: numberOfTextLines, iconSize: iconSize) + let cellData = MainTimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.feed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcon, numberOfLines: numberOfTextLines, iconSize: iconSize) return cellData } @@ -983,7 +983,7 @@ private extension MainTimelineViewController { } func discloseFeedAction(_ article: Article) -> UIAction? { - guard let webFeed = article.webFeed, + guard let webFeed = article.feed, !timelineFeedIsEqualTo(webFeed) else { return nil } let title = NSLocalizedString("Go to Feed", comment: "Go to Feed") @@ -994,7 +994,7 @@ private extension MainTimelineViewController { } func discloseFeedAlertAction(_ article: Article, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = article.webFeed, + guard let webFeed = article.feed, !timelineFeedIsEqualTo(webFeed) else { return nil } let title = NSLocalizedString("Go to Feed", comment: "Go to Feed") @@ -1011,7 +1011,7 @@ private extension MainTimelineViewController { } func markAllInFeedAsReadAction(_ article: Article, indexPath: IndexPath) -> UIAction? { - guard let webFeed = article.webFeed else { return nil } + guard let webFeed = article.feed else { return nil } guard let fetchedArticles = try? webFeed.fetchArticles() else { return nil } @@ -1034,7 +1034,7 @@ private extension MainTimelineViewController { } func markAllInFeedAsReadAlertAction(_ article: Article, indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = article.webFeed else { return nil } + guard let webFeed = article.feed else { return nil } guard let fetchedArticles = try? webFeed.fetchArticles() else { return nil } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index aeeadd146..0d4c85e72 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1253,7 +1253,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner { func showFeedInspector() { let timelineWebFeed = timelineFeed as? Feed - let articleFeed = currentArticle?.webFeed + let articleFeed = currentArticle?.feed guard let feed = timelineWebFeed ?? articleFeed else { return }