diff --git a/Mac/Base.lproj/AddWebFeedSheet.xib b/Mac/Base.lproj/AddWebFeedSheet.xib index 6b9a63af6..7e066f123 100644 --- a/Mac/Base.lproj/AddWebFeedSheet.xib +++ b/Mac/Base.lproj/AddWebFeedSheet.xib @@ -5,7 +5,7 @@ - + diff --git a/Mac/Inspector/Base.lproj/Inspector.storyboard b/Mac/Inspector/Base.lproj/Inspector.storyboard index 9aae55e24..ffdae6b34 100644 --- a/Mac/Inspector/Base.lproj/Inspector.storyboard +++ b/Mac/Inspector/Base.lproj/Inspector.storyboard @@ -1,8 +1,7 @@ - + - - + @@ -32,7 +31,7 @@ - + diff --git a/Mac/Inspector/WebFeedInspectorViewController.swift b/Mac/Inspector/FeedInspectorViewController.swift similarity index 96% rename from Mac/Inspector/WebFeedInspectorViewController.swift rename to Mac/Inspector/FeedInspectorViewController.swift index 29f6ab422..2643fb4a8 100644 --- a/Mac/Inspector/WebFeedInspectorViewController.swift +++ b/Mac/Inspector/FeedInspectorViewController.swift @@ -11,7 +11,7 @@ import Articles import Account import UserNotifications -@MainActor final class WebFeedInspectorViewController: NSViewController, Inspector { +@MainActor final class FeedInspectorViewController: NSViewController, Inspector { @IBOutlet weak var iconView: IconView! @IBOutlet weak var nameTextField: NSTextField? @@ -112,7 +112,7 @@ import UserNotifications } -extension WebFeedInspectorViewController: NSTextFieldDelegate { +extension FeedInspectorViewController: NSTextFieldDelegate { func controlTextDidEndEditing(_ note: Notification) { renameFeedIfNecessary() @@ -120,7 +120,7 @@ extension WebFeedInspectorViewController: NSTextFieldDelegate { } -private extension WebFeedInspectorViewController { +private extension FeedInspectorViewController { func updateFeed() { guard let objects = objects, objects.count == 1, let singleFeed = objects.first as? Feed else { diff --git a/Mac/MainWindow/AddFeed/AddFeedController.swift b/Mac/MainWindow/AddFeed/AddFeedController.swift index 2ad9473c3..5e2212f10 100644 --- a/Mac/MainWindow/AddFeed/AddFeedController.swift +++ b/Mac/MainWindow/AddFeed/AddFeedController.swift @@ -39,7 +39,7 @@ import RSParser switch type { case .feed: - addFeedWindowController = AddWebFeedWindowController(urlString: urlString ?? urlStringFromPasteboard, + addFeedWindowController = AddFeedWindowController(urlString: urlString ?? urlStringFromPasteboard, name: name, account: account, folder: folder, @@ -73,7 +73,7 @@ import RSParser switch result { case .success(let feed): - NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.webFeed: feed]) + NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed]) case .failure(let error): switch error { case AccountError.createErrorAlreadySubscribed: diff --git a/Mac/MainWindow/AddFeed/AddFeedWIndowController.swift b/Mac/MainWindow/AddFeed/AddFeedWIndowController.swift index 74f217c4d..861489aea 100644 --- a/Mac/MainWindow/AddFeed/AddFeedWIndowController.swift +++ b/Mac/MainWindow/AddFeed/AddFeedWIndowController.swift @@ -21,7 +21,7 @@ enum AddFeedWindowControllerType { } -@MainActor protocol AddFeedWindowController { +@MainActor protocol AddFeedWindowControllerProtocol { var window: NSWindow? { get } func runSheetOnWindow(_ hostWindow: NSWindow) diff --git a/Mac/MainWindow/AddFeed/AddWebFeedWindowController.swift b/Mac/MainWindow/AddFeed/AddWebFeedWindowController.swift index 40b6f6301..fb9a3c82c 100644 --- a/Mac/MainWindow/AddFeed/AddWebFeedWindowController.swift +++ b/Mac/MainWindow/AddFeed/AddWebFeedWindowController.swift @@ -12,7 +12,7 @@ import RSTree import Articles import Account -@MainActor final class AddWebFeedWindowController : NSWindowController, AddFeedWindowController { +@MainActor final class AddFeedWindowController : NSWindowController, AddFeedWindowControllerProtocol { @IBOutlet var urlTextField: NSTextField! @IBOutlet var nameTextField: NSTextField! @@ -38,7 +38,7 @@ import Account var hostWindow: NSWindow! convenience init(urlString: String?, name: String?, account: Account?, folder: Folder?, folderTreeController: TreeController, delegate: AddFeedWindowControllerDelegate?) { - self.init(windowNibName: NSNib.Name("AddWebFeedSheet")) + self.init(windowNibName: NSNib.Name("AddFeedSheet")) self.urlString = urlString self.initialName = name self.initialAccount = account @@ -64,7 +64,7 @@ import Account if let account = initialAccount { FolderTreeMenu.select(account: account, folder: initialFolder, in: folderPopupButton) - } else if let container = AddWebFeedDefaultContainer.defaultContainer { + } else if let container = AddFeedDefaultContainer.defaultContainer { if let folder = container as? Folder, let account = folder.account { FolderTreeMenu.select(account: account, folder: folder, in: folderPopupButton) } else { @@ -97,7 +97,7 @@ import Account } guard let container = selectedContainer() else { return } - AddWebFeedDefaultContainer.saveDefaultContainer(container) + AddFeedDefaultContainer.saveDefaultContainer(container) delegate?.addFeedWindowController(self, userEnteredURL: url, userEnteredTitle: userEnteredTitle, container: container) @@ -119,7 +119,7 @@ import Account } } -private extension AddWebFeedWindowController { +private extension AddFeedWindowController { private func updateUI() { addButton.isEnabled = urlTextField.stringValue.mayBeURL && selectedContainer() != nil diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index b861b9922..07f50a461 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -119,7 +119,7 @@ protocol DetailWebViewControllerDelegate: AnyObject { NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil) #endif - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) @@ -130,7 +130,7 @@ protocol DetailWebViewControllerDelegate: AnyObject { // MARK: Notifications - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { reloadArticleImage() } diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 32084458d..e70335d59 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -706,14 +706,13 @@ extension MainWindowController: TimelineContainerViewControllerDelegate { detailViewController?.setState(detailState, mode: mode) } - func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed) { - sidebarViewController?.selectFeed(webFeed) + func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed) { + sidebarViewController?.selectFeed(feed) } func timelineInvalidatedRestorationState(_: TimelineContainerViewController) { invalidateRestorableState() } - } // MARK: - NSSearchFieldDelegate @@ -1439,10 +1438,10 @@ private extension MainWindowController { func buildNewSidebarItemMenu() -> NSMenu { let menu = NSMenu() - let newWebFeedItem = NSMenuItem() - newWebFeedItem.title = NSLocalizedString("button.title.new-web-feed", comment: "New Feed...") - newWebFeedItem.action = Selector(("showAddFeedWindow:")) - menu.addItem(newWebFeedItem) + let newFeedItem = NSMenuItem() + newFeedItem.title = NSLocalizedString("button.title.new-feed", comment: "New Feed...") + newFeedItem.action = Selector(("showAddFeedWindow:")) + menu.addItem(newFeedItem) let newFolderFeedItem = NSMenuItem() newFolderFeedItem.title = NSLocalizedString("button.title.open-new-folder", comment: "New Folder...") diff --git a/Mac/MainWindow/Sidebar/PasteboardFeed.swift b/Mac/MainWindow/Sidebar/PasteboardFeed.swift index 00ae9d2ca..7d2cca788 100644 --- a/Mac/MainWindow/Sidebar/PasteboardFeed.swift +++ b/Mac/MainWindow/Sidebar/PasteboardFeed.swift @@ -74,11 +74,11 @@ struct PasteboardFeed: Hashable { init?(pasteboardItem: NSPasteboardItem) { var pasteboardType: NSPasteboard.PasteboardType? - if pasteboardItem.types.contains(FeedPasteboardWriter.webFeedUTIInternalType) { - pasteboardType = FeedPasteboardWriter.webFeedUTIInternalType + if pasteboardItem.types.contains(FeedPasteboardWriter.feedUTIInternalType) { + pasteboardType = FeedPasteboardWriter.feedUTIInternalType } - else if pasteboardItem.types.contains(FeedPasteboardWriter.webFeedUTIType) { - pasteboardType = FeedPasteboardWriter.webFeedUTIType + else if pasteboardItem.types.contains(FeedPasteboardWriter.feedUTIType) { + pasteboardType = FeedPasteboardWriter.feedUTIType } if let foundType = pasteboardType { if let feedDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardFeedDictionary { @@ -111,8 +111,8 @@ struct PasteboardFeed: Hashable { guard let items = pasteboard.pasteboardItems else { return nil } - let webFeeds = items.compactMap { PasteboardFeed(pasteboardItem: $0) } - return webFeeds.isEmpty ? nil : Set(webFeeds) + let feeds = items.compactMap { PasteboardFeed(pasteboardItem: $0) } + return feeds.isEmpty ? nil : Set(feeds) } // MARK: - Writing @@ -156,29 +156,29 @@ struct PasteboardFeed: Hashable { extension Feed: PasteboardWriterOwner { public var pasteboardWriter: NSPasteboardWriting { - return FeedPasteboardWriter(webFeed: self) + return FeedPasteboardWriter(feed: self) } } @objc final class FeedPasteboardWriter: NSObject, NSPasteboardWriting { - private let webFeed: Feed - static let webFeedUTI = "com.ranchero.webFeed" - static let webFeedUTIType = NSPasteboard.PasteboardType(rawValue: webFeedUTI) - static let webFeedUTIInternal = "com.ranchero.NetNewsWire-Evergreen.internal.webFeed" - static let webFeedUTIInternalType = NSPasteboard.PasteboardType(rawValue: webFeedUTIInternal) + private let feed: Feed + static let feedUTI = "com.ranchero.feed" + static let feedUTIType = NSPasteboard.PasteboardType(rawValue: feedUTI) + static let feedUTIInternal = "com.ranchero.NetNewsWire-Evergreen.internal.feed" + static let feedUTIInternalType = NSPasteboard.PasteboardType(rawValue: feedUTIInternal) var containerID: ContainerIdentifier? = nil - init(webFeed: Feed) { - self.webFeed = webFeed + init(feed: Feed) { + self.feed = feed } // MARK: - NSPasteboardWriting func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] { - return [FeedPasteboardWriter.webFeedUTIType, .URL, .string, FeedPasteboardWriter.webFeedUTIInternalType] + return [FeedPasteboardWriter.feedUTIType, .URL, .string, FeedPasteboardWriter.feedUTIInternalType] } func pasteboardPropertyList(forType type: NSPasteboard.PasteboardType) -> Any? { @@ -187,12 +187,12 @@ extension Feed: PasteboardWriterOwner { switch type { case .string: - plist = webFeed.nameForDisplay + plist = feed.nameForDisplay case .URL: - plist = webFeed.url - case FeedPasteboardWriter.webFeedUTIType: + plist = feed.url + case FeedPasteboardWriter.feedUTIType: plist = exportDictionary - case FeedPasteboardWriter.webFeedUTIInternalType: + case FeedPasteboardWriter.feedUTIInternalType: plist = internalDictionary default: plist = nil @@ -205,7 +205,7 @@ extension Feed: PasteboardWriterOwner { private extension FeedPasteboardWriter { var pasteboardFeed: PasteboardFeed { - return PasteboardFeed(url: webFeed.url, feedID: webFeed.feedID, homePageURL: webFeed.homePageURL, name: webFeed.name, editedName: webFeed.editedName, accountID: webFeed.account?.accountID, accountType: webFeed.account?.type) + return PasteboardFeed(url: feed.url, feedID: feed.feedID, homePageURL: feed.homePageURL, name: feed.name, editedName: feed.editedName, accountID: feed.account?.accountID, accountType: feed.account?.type) } var exportDictionary: PasteboardFeedDictionary { diff --git a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift index f1376e56f..80b58ff87 100644 --- a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift +++ b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift @@ -47,7 +47,7 @@ import Account return nil } - // WebFeed objects don't have knowledge of their parent so we inject parent container information + // Feed objects don't have knowledge of their parent so we inject parent container information // into FeedPasteboardWriter instance and it adds this field to the PasteboardFeed objects it writes. // Add similar to FolderPasteboardWriter if/when we allow sub-folders if let feedWriter = pasteboardWriter as? FeedPasteboardWriter { @@ -315,7 +315,7 @@ private extension SidebarOutlineDataSource { return .copy // different AccountIDs means can only copy } - func copyWebFeedInAccount(_ feed: Feed, _ destination: Container ) { + func copyFeedInAccount(_ feed: Feed, _ destination: Container ) { destination.account?.addFeed(feed, to: destination) { result in switch result { case .success: @@ -339,7 +339,7 @@ private extension SidebarOutlineDataSource { } } - func copyWebFeedBetweenAccounts(_ feed: Feed, _ destinationContainer: Container) { + func copyFeedBetweenAccounts(_ feed: Feed, _ destinationContainer: Container) { guard let destinationAccount = destinationContainer.account else { return } @@ -373,8 +373,8 @@ private extension SidebarOutlineDataSource { draggedFeeds.forEach { pasteboardFeed in guard let sourceAccountID = pasteboardFeed.accountID, let sourceAccount = AccountManager.shared.existingAccount(with: sourceAccountID), - let webFeedID = pasteboardFeed.feedID, - let feed = sourceAccount.existingFeed(withFeedID: webFeedID), + let feedID = pasteboardFeed.feedID, + let feed = sourceAccount.existingFeed(withFeedID: feedID), let destinationContainer = parentNode.representedObject as? Container else { return @@ -391,12 +391,12 @@ private extension SidebarOutlineDataSource { if sameAccount(pasteboardFeed, parentNode) { if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false { - copyWebFeedInAccount(feed, destinationContainer) + copyFeedInAccount(feed, destinationContainer) } else { moveFeedInAccount(feed, sourceContainer, destinationContainer) } } else { - copyWebFeedBetweenAccounts(feed, destinationContainer) + copyFeedBetweenAccounts(feed, destinationContainer) } } @@ -553,8 +553,8 @@ private extension SidebarOutlineDataSource { return account } else if let folder = node.representedObject as? Folder { return folder.account - } else if let webFeed = node.representedObject as? Feed { - return webFeed.account + } else if let feed = node.representedObject as? Feed { + return feed.account } else { return nil } diff --git a/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift b/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift index bf1b3c429..ab6fde823 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift @@ -264,14 +264,14 @@ private extension SidebarViewController { return menu } - func menuForFeed(_ webFeed: Feed) -> NSMenu? { + func menuForFeed(_ feed: Feed) -> NSMenu? { let menu = NSMenu(title: "") - if webFeed.unreadCount > 0 { - menu.addItem(markAllReadMenuItem([webFeed])) + if feed.unreadCount > 0 { + menu.addItem(markAllReadMenuItem([feed])) let catchUpMenuItem = NSMenuItem(title: NSLocalizedString("button.title.mark-as-read-older-than", comment: "Mark as Read Older Than"), action: nil, keyEquivalent: "") - let catchUpSubMenu = catchUpSubMenu([webFeed]) + let catchUpSubMenu = catchUpSubMenu([feed]) menu.addItem(catchUpMenuItem) menu.setSubmenu(catchUpSubMenu, for: catchUpMenuItem) @@ -279,25 +279,25 @@ private extension SidebarViewController { menu.addItem(NSMenuItem.separator()) } - if let homePageURL = webFeed.homePageURL, let _ = URL(string: homePageURL) { + if let homePageURL = feed.homePageURL, let _ = URL(string: homePageURL) { let item = menuItem(NSLocalizedString("button.title.open-home-page", comment: "Open Home Page"), #selector(openHomePageFromContextualMenu(_:)), homePageURL.decodedURLString ?? homePageURL) menu.addItem(item) menu.addItem(NSMenuItem.separator()) } - let copyFeedURLItem = menuItem(NSLocalizedString("button.title.copy-feed-url", comment: "Copy Feed URL"), #selector(copyURLFromContextualMenu(_:)), webFeed.url.decodedURLString ?? webFeed.url) + let copyFeedURLItem = menuItem(NSLocalizedString("button.title.copy-feed-url", comment: "Copy Feed URL"), #selector(copyURLFromContextualMenu(_:)), feed.url.decodedURLString ?? feed.url) menu.addItem(copyFeedURLItem) - if let homePageURL = webFeed.homePageURL { + if let homePageURL = feed.homePageURL { let item = menuItem(NSLocalizedString("button.title.copy-home-page-url", comment: "Copy Home Page URL"), #selector(copyURLFromContextualMenu(_:)), homePageURL.decodedURLString ?? homePageURL) menu.addItem(item) } menu.addItem(NSMenuItem.separator()) - let notificationText = webFeed.notificationDisplayName.capitalized + let notificationText = feed.notificationDisplayName.capitalized - let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), webFeed) - if webFeed.isNotifyAboutNewArticles == nil || webFeed.isNotifyAboutNewArticles! == false { + let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), feed) + if feed.isNotifyAboutNewArticles == nil || feed.isNotifyAboutNewArticles! == false { notificationMenuItem.state = .off } else { notificationMenuItem.state = .on @@ -305,9 +305,9 @@ private extension SidebarViewController { menu.addItem(notificationMenuItem) let articleExtractorText = NSLocalizedString("button.title.always-use-reader-view", comment: "Always Use Reader View") - let articleExtractorMenuItem = menuItem(articleExtractorText, #selector(toggleArticleExtractorFromContextMenu(_:)), webFeed) + let articleExtractorMenuItem = menuItem(articleExtractorText, #selector(toggleArticleExtractorFromContextMenu(_:)), feed) - if webFeed.isArticleExtractorAlwaysOn == nil || webFeed.isArticleExtractorAlwaysOn! == false { + if feed.isArticleExtractorAlwaysOn == nil || feed.isArticleExtractorAlwaysOn! == false { articleExtractorMenuItem.state = .off } else { articleExtractorMenuItem.state = .on @@ -316,8 +316,8 @@ private extension SidebarViewController { menu.addItem(NSMenuItem.separator()) - menu.addItem(renameMenuItem(webFeed)) - menu.addItem(deleteMenuItem([webFeed])) + menu.addItem(renameMenuItem(feed)) + menu.addItem(deleteMenuItem([feed])) return menu } diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index ca4277dd6..85e02fe69 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -67,7 +67,7 @@ protocol SidebarDelegate: AnyObject { outlineView.dataSource = dataSource outlineView.doubleAction = #selector(doubleClickedSidebar(_:)) outlineView.setDraggingSourceOperationMask([.move, .copy], forLocal: true) - outlineView.registerForDraggedTypes([FeedPasteboardWriter.webFeedUTIInternalType, FeedPasteboardWriter.webFeedUTIType, .URL, .string]) + outlineView.registerForDraggedTypes([FeedPasteboardWriter.feedUTIInternalType, FeedPasteboardWriter.feedUTIType, .URL, .string]) NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidInitialize(_:)), name: .UnreadCountDidInitialize, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) @@ -78,8 +78,8 @@ protocol SidebarDelegate: AnyObject { NotificationCenter.default.addObserver(self, selector: #selector(userDidAddFeed(_:)), name: .UserDidAddFeed, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) DistributedNotificationCenter.default().addObserver(self, selector: #selector(appleSideBarDefaultIconSizeChanged(_:)), name: .appleSideBarDefaultIconSizeChanged, object: nil) @@ -186,7 +186,7 @@ protocol SidebarDelegate: AnyObject { } @objc func userDidAddFeed(_ notification: Notification) { - guard let feed = notification.userInfo?[UserInfoKey.webFeed] else { + guard let feed = notification.userInfo?[UserInfoKey.feed] else { return } revealAndSelectRepresentedObject(feed as AnyObject) @@ -196,17 +196,17 @@ protocol SidebarDelegate: AnyObject { applyToAvailableCells(configureFavicon) } - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { - guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed else { return } - configureCellsForRepresentedObject(webFeed) + @objc func feedIconDidBecomeAvailable(_ note: Notification) { + guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else { return } + configureCellsForRepresentedObject(feed) } - @objc func webFeedSettingDidChange(_ note: Notification) { - guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else { + @objc func feedSettingDidChange(_ note: Notification) { + guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else { return } if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL { - configureCellsForRepresentedObject(webFeed) + configureCellsForRepresentedObject(feed) } } @@ -258,7 +258,7 @@ protocol SidebarDelegate: AnyObject { guard outlineView.clickedRow == outlineView.selectedRow else { return } - if AppDefaults.shared.feedDoubleClickMarkAsRead, let articles = try? singleSelectedWebFeed?.fetchUnreadArticles() { + if AppDefaults.shared.feedDoubleClickMarkAsRead, let articles = try? singleSelectedFeed?.fetchUnreadArticles() { if let undoManager = undoManager, let markReadCommand = MarkStatusCommand(initialArticles: Array(articles), markingRead: true, @@ -271,7 +271,7 @@ protocol SidebarDelegate: AnyObject { } @IBAction func openInBrowser(_ sender: Any?) { - guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else { + guard let feed = singleSelectedFeed, let homePageURL = feed.homePageURL else { return } Browser.open(homePageURL, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false) @@ -279,7 +279,7 @@ protocol SidebarDelegate: AnyObject { @objc func openInAppBrowser(_ sender: Any?) { // There is no In-App Browser for mac - so we use safari - guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else { + guard let feed = singleSelectedFeed, let homePageURL = feed.homePageURL else { return } Browser.open(homePageURL, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false) @@ -459,8 +459,8 @@ protocol SidebarDelegate: AnyObject { if isReadFiltered, let itemID = feed.itemID { self.treeControllerDelegate.addFilterException(itemID) - if let webFeed = feed as? Feed, let account = webFeed.account { - let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(webFeed) }) + if let feed = feed as? Feed, let account = feed.account { + let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(feed) }) if let parentFolderItemID = parentFolder?.itemID { self.treeControllerDelegate.addFilterException(parentFolderItemID) } @@ -532,7 +532,7 @@ private extension SidebarViewController { return selectedNodes.first! } - var singleSelectedWebFeed: Feed? { + var singleSelectedFeed: Feed? { guard let node = singleSelectedNode else { return nil } @@ -543,18 +543,18 @@ private extension SidebarViewController { selectedFeeds.forEach { addToFilterExeptionsIfNecessary($0) } } - func addToFilterExeptionsIfNecessary(_ feed: FeedProtocol?) { - if isReadFiltered, let itemID = feed?.itemID { - if feed is PseudoFeed { + func addToFilterExeptionsIfNecessary(_ feedProtocol: FeedProtocol?) { + if isReadFiltered, let itemID = feedProtocol?.itemID { + if feedProtocol is PseudoFeed { treeControllerDelegate.addFilterException(itemID) - } else if let folderFeed = feed as? Folder { + } else if let folderFeed = feedProtocol as? Folder { if folderFeed.account?.existingFolder(withID: folderFeed.folderID) != nil { treeControllerDelegate.addFilterException(itemID) } - } else if let webFeed = feed as? Feed { - if webFeed.account?.existingFeed(withFeedID: webFeed.feedID) != nil { + } else if let feed = feedProtocol as? Feed { + if feed.account?.existingFeed(withFeedID: feed.feedID) != nil { treeControllerDelegate.addFilterException(itemID) - addParentFolderToFilterExceptions(webFeed) + addParentFolderToFilterExceptions(feed) } } } @@ -749,10 +749,10 @@ private extension SidebarViewController { } func findFeedNode(_ userInfo: [AnyHashable : Any]?, beginningAt startingNode: Node) -> Node? { - guard let webFeedID = userInfo?[ArticlePathKey.webFeedID] as? String else { + guard let feedID = userInfo?[ArticlePathKey.feedID] as? String else { return nil } - if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == webFeedID }) { + if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == feedID }) { return node } return nil diff --git a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift index c83d1dd27..427b2820d 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.feedID + 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/TimelineContainerViewController.swift b/Mac/MainWindow/Timeline/TimelineContainerViewController.swift index ac83c71f9..4ad5c16b5 100644 --- a/Mac/MainWindow/Timeline/TimelineContainerViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineContainerViewController.swift @@ -12,7 +12,7 @@ import Articles protocol TimelineContainerViewControllerDelegate: AnyObject { func timelineSelectionDidChange(_: TimelineContainerViewController, articles: [Article]?, mode: TimelineSourceMode) - func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed) + func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed) func timelineInvalidatedRestorationState(_: TimelineContainerViewController) } @@ -141,8 +141,8 @@ extension TimelineContainerViewController: TimelineDelegate { delegate?.timelineSelectionDidChange(self, articles: selectedArticles, mode: mode(for: timelineViewController)) } - func timelineRequestedWebFeedSelection(_: TimelineViewController, webFeed: Feed) { - delegate?.timelineRequestedWebFeedSelection(self, webFeed: webFeed) + func timelineRequestedFeedSelection(_: TimelineViewController, feed: Feed) { + delegate?.timelineRequestedFeedSelection(self, feed: feed) } func timelineInvalidatedRestorationState(_: TimelineViewController) { diff --git a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift index ba354634a..9717d056a 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift @@ -70,10 +70,10 @@ extension TimelineViewController { } @objc func selectFeedInSidebarFromContextualMenu(_ sender: Any?) { - guard let menuItem = sender as? NSMenuItem, let webFeed = menuItem.representedObject as? Feed else { + guard let menuItem = sender as? NSMenuItem, let feed = menuItem.representedObject as? Feed else { return } - delegate?.timelineRequestedWebFeedSelection(self, webFeed: webFeed) + delegate?.timelineRequestedFeedSelection(self, feed: feed) } @objc func markAllInFeedAsRead(_ sender: Any?) { diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index b4c1c9326..ff7d2e73d 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -13,7 +13,7 @@ import Account protocol TimelineDelegate: AnyObject { func timelineSelectionDidChange(_: TimelineViewController, selectedArticles: [Article]?) - func timelineRequestedWebFeedSelection(_: TimelineViewController, webFeed: Feed) + func timelineRequestedFeedSelection(_: TimelineViewController, feed: Feed) func timelineInvalidatedRestorationState(_: TimelineViewController) } @@ -219,7 +219,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr if !didRegisterForNotifications { NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil) @@ -649,8 +649,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr updateUnreadCount() } - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { - guard showIcons, let feed = note.userInfo?[UserInfoKey.webFeed] as? Feed else { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { + guard showIcons, let feed = note.userInfo?[UserInfoKey.feed] as? Feed else { return } let indexesToReload = tableView.indexesOfAvailableRowsPassingTest { (row) -> Bool in @@ -696,7 +696,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr return } - let shouldFetchAndMergeArticles = representedObjectsContainsAnyWebFeed(feeds) || representedObjectsContainsAnyPseudoFeed() + let shouldFetchAndMergeArticles = representedObjectsContainsAnyFeed(feeds) || representedObjectsContainsAnyPseudoFeed() if shouldFetchAndMergeArticles { queueFetchAndMergeArticles() } @@ -1317,7 +1317,7 @@ private extension TimelineViewController { return representedObjects?.contains(where: { $0 is Folder }) ?? false } - func representedObjectsContainsAnyWebFeed(_ webFeeds: Set) -> Bool { + func representedObjectsContainsAnyFeed(_ feeds: Set) -> Bool { // Return true if there’s a match or if a folder contains (recursively) one of feeds guard let representedObjects = representedObjects else { @@ -1325,14 +1325,14 @@ private extension TimelineViewController { } for representedObject in representedObjects { if let feed = representedObject as? Feed { - for oneFeed in webFeeds { + for oneFeed in feeds { if feed.feedID == oneFeed.feedID || feed.url == oneFeed.url { return true } } } else if let folder = representedObject as? Folder { - for oneFeed in webFeeds { + for oneFeed in feeds { if folder.hasFeed(with: oneFeed.feedID) || folder.hasFeed(withURL: oneFeed.url) { return true } diff --git a/Mac/Resources/NetNewsWire.sdef b/Mac/Resources/NetNewsWire.sdef index 4eebbc6d9..c2750299a 100644 --- a/Mac/Resources/NetNewsWire.sdef +++ b/Mac/Resources/NetNewsWire.sdef @@ -60,8 +60,8 @@ - - + + @@ -92,22 +92,22 @@ - - - + + + - - + + - + @@ -169,8 +169,8 @@ - - + + @@ -221,7 +221,7 @@ - + diff --git a/Mac/Scriptability/Account+Scriptability.swift b/Mac/Scriptability/Account+Scriptability.swift index 715beee21..0c7c84380 100644 --- a/Mac/Scriptability/Account+Scriptability.swift +++ b/Mac/Scriptability/Account+Scriptability.swift @@ -94,19 +94,19 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta // MARK: --- Scriptable elements --- - @objc(webFeeds) - var webFeeds:NSArray { + @objc(feeds) + var feeds:NSArray { return account.topLevelFeeds.map { ScriptableFeed($0, container:self) } as NSArray } - @objc(valueInWebFeedsWithUniqueID:) - func valueInWebFeeds(withUniqueID id:String) -> ScriptableFeed? { + @objc(valueInFeedsWithUniqueID:) + func valueInFeeds(withUniqueID id:String) -> ScriptableFeed? { guard let feed = account.existingFeed(withFeedID: id) else { return nil } return ScriptableFeed(feed, container:self) } - @objc(valueInWebFeedsWithName:) - func valueInWebFeeds(withName name:String) -> ScriptableFeed? { + @objc(valueInFeedsWithName:) + func valueInFeeds(withName name:String) -> ScriptableFeed? { let feeds = Array(account.flattenedFeeds()) guard let feed = feeds.first(where:{$0.name == name}) else { return nil } return ScriptableFeed(feed, container:self) @@ -130,21 +130,21 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta // MARK: --- Scriptable properties --- - @objc(allWebFeeds) - var allWebFeeds: NSArray { - var webFeeds = [ScriptableFeed]() - for webFeed in account.topLevelFeeds { - webFeeds.append(ScriptableFeed(webFeed, container: self)) + @objc(allFeeds) + var allFeeds: NSArray { + var feeds = [ScriptableFeed]() + for feed in account.topLevelFeeds { + feeds.append(ScriptableFeed(feed, container: self)) } if let folders = account.folders { for folder in folders { let scriptableFolder = ScriptableFolder(folder, container: self) - for webFeed in folder.topLevelFeeds { - webFeeds.append(ScriptableFeed(webFeed, container: scriptableFolder)) + for feed in folder.topLevelFeeds { + feeds.append(ScriptableFeed(feed, container: scriptableFolder)) } } } - return webFeeds as NSArray + return feeds as NSArray } @objc(opmlRepresentation) diff --git a/Mac/Scriptability/AppDelegate+Scriptability.swift b/Mac/Scriptability/AppDelegate+Scriptability.swift index bd3dfa013..42dc68068 100644 --- a/Mac/Scriptability/AppDelegate+Scriptability.swift +++ b/Mac/Scriptability/AppDelegate+Scriptability.swift @@ -97,7 +97,7 @@ extension AppDelegate : AppDelegateAppleEvents { class NetNewsWireCreateElementCommand : NSCreateCommand { override func performDefaultImplementation() -> Any? { let classDescription = self.createClassDescription - if (classDescription.className == "webFeed") { + if (classDescription.className == "feed") { return ScriptableFeed.handleCreateElement(command:self) } else if (classDescription.className == "folder") { return ScriptableFolder.handleCreateElement(command:self) diff --git a/Mac/Scriptability/Folder+Scriptability.swift b/Mac/Scriptability/Folder+Scriptability.swift index 475b9774b..61925db59 100644 --- a/Mac/Scriptability/Folder+Scriptability.swift +++ b/Mac/Scriptability/Folder+Scriptability.swift @@ -95,8 +95,8 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObjectContai // MARK: --- Scriptable elements --- - @objc(webFeeds) - var webFeeds:NSArray { + @objc(feeds) + var feeds:NSArray { let feeds = Array(folder.topLevelFeeds) return feeds.map { ScriptableFeed($0, container:self) } as NSArray } diff --git a/Mac/Scriptability/NSApplication+Scriptability.swift b/Mac/Scriptability/NSApplication+Scriptability.swift index 5733719c5..60308428e 100644 --- a/Mac/Scriptability/NSApplication+Scriptability.swift +++ b/Mac/Scriptability/NSApplication+Scriptability.swift @@ -73,26 +73,26 @@ extension NSApplication : ScriptingObjectContainer { for 'articles of feed "The Shape of Everything" of account "On My Mac"' */ - func allWebFeeds() -> [Feed] { + func allFeeds() -> [Feed] { let accounts = AccountManager.shared.activeAccounts - let emptyFeeds:[Feed] = [] + let emptyFeeds: [Feed] = [] return accounts.reduce(emptyFeeds) { (result, nthAccount) -> [Feed] in let accountFeeds = Array(nthAccount.topLevelFeeds) return result + accountFeeds } } - @objc(webFeeds) - func webFeeds() -> NSArray { - let webFeeds = self.allWebFeeds() - return webFeeds.map { ScriptableFeed($0, container:self) } as NSArray + @objc(feeds) + func feeds() -> NSArray { + let feeds = self.allFeeds() + return feeds.map { ScriptableFeed($0, container:self) } as NSArray } - @objc(valueInWebFeedsWithUniqueID:) - func valueInWebFeeds(withUniqueID id:String) -> ScriptableFeed? { - let webFeeds = self.allWebFeeds() - guard let webFeed = webFeeds.first(where:{$0.feedID == id}) else { return nil } - return ScriptableFeed(webFeed, container:self) + @objc(valueInFeedsWithUniqueID:) + func valueInFeeds(withUniqueID id:String) -> ScriptableFeed? { + let feeds = self.allFeeds() + guard let feed = feeds.first(where:{$0.feedID == id}) else { return nil } + return ScriptableFeed(feed, container:self) } } diff --git a/Mac/Scriptability/WebFeed+Scriptability.swift b/Mac/Scriptability/WebFeed+Scriptability.swift index 9779c757d..2377c9135 100644 --- a/Mac/Scriptability/WebFeed+Scriptability.swift +++ b/Mac/Scriptability/WebFeed+Scriptability.swift @@ -36,7 +36,7 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine // MARK: --- ScriptingObject protocol --- var scriptingKey: String { - return "webFeeds" + return "feeds" } // MARK: --- UniqueIdScriptingObject protocol --- @@ -105,7 +105,7 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine account.createFeed(url: url, name: titleFromArgs, container: container, validateFeed: true) { result in switch result { case .success(let feed): - NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.webFeed: feed]) + NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed]) let scriptableFeed = self.scriptableFeed(feed, account:account, folder:folder) command.resumeExecution(withResult:scriptableFeed.objectSpecifier) case .failure: diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index e38bbe157..46411b223 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -225,7 +225,7 @@ 519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; }; 51A052CE244FB9D7006C2024 /* AddFeedWIndowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */; }; 51A052CF244FB9D7006C2024 /* AddFeedWIndowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */; }; - 51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; + 51A66685238075AE00CB272D /* AddFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */; }; 51A737AE24DB19730015FA66 /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 51A737AD24DB19730015FA66 /* RSCore */; }; 51A737AF24DB19730015FA66 /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51A737AD24DB19730015FA66 /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 51A737BF24DB197F0015FA66 /* RSDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 51A737BE24DB197F0015FA66 /* RSDatabase */; }; @@ -241,8 +241,8 @@ 51A9A5ED2380D6000033AADF /* AppAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C45254226507D200C03939 /* AppAssets.swift */; }; 51A9A5EE2380D6080033AADF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */; }; 51A9A5EF2380D63B0033AADF /* IconImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE9DE2372269A007DEEAA /* IconImage.swift */; }; - 51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; - 51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; + 51A9A5F22380DE520033AADF /* AddFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */; }; + 51A9A5F32380DE530033AADF /* AddFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */; }; 51A9A5F52380F6A60033AADF /* ModalNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */; }; 51A9A60A2382FD240033AADF /* PoppableGestureRecognizerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */; }; 51AB8AB323B7F4C6008F147D /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51AB8AB223B7F4C6008F147D /* WebViewController.swift */; }; @@ -486,7 +486,7 @@ 65ED3FF7235DEF6C0081F399 /* SearchFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8477ACBD22238E9500DF7F37 /* SearchFeedDelegate.swift */; }; 65ED3FF8235DEF6C0081F399 /* ErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E3EB32229AB02C00645299 /* ErrorHandler.swift */; }; 65ED3FF9235DEF6C0081F399 /* ActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51934CCD2310792F006127BE /* ActivityManager.swift */; }; - 65ED3FFA235DEF6C0081F399 /* WebFeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8472058020142E8900AD578B /* WebFeedInspectorViewController.swift */; }; + 65ED3FFA235DEF6C0081F399 /* FeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8472058020142E8900AD578B /* FeedInspectorViewController.swift */; }; 65ED3FFB235DEF6C0081F399 /* AccountsReaderAPIWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E15BCA229D65A900D6602A /* AccountsReaderAPIWindowController.swift */; }; 65ED3FFC235DEF6C0081F399 /* AccountsAddLocalWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5144EA372279FC6200D19003 /* AccountsAddLocalWindowController.swift */; }; 65ED3FFD235DEF6C0081F399 /* PasteboardFolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA92031617300BC20B7 /* PasteboardFolder.swift */; }; @@ -622,7 +622,7 @@ 845EE7B11FC2366500854A1F /* StarredFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845EE7B01FC2366500854A1F /* StarredFeedDelegate.swift */; }; 845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845EE7C01FC2488C00854A1F /* SmartFeed.swift */; }; 84702AA41FA27AC0006B8943 /* MarkStatusCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84702AA31FA27AC0006B8943 /* MarkStatusCommand.swift */; }; - 8472058120142E8900AD578B /* WebFeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8472058020142E8900AD578B /* WebFeedInspectorViewController.swift */; }; + 8472058120142E8900AD578B /* FeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8472058020142E8900AD578B /* FeedInspectorViewController.swift */; }; 8477ACBE22238E9500DF7F37 /* SearchFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8477ACBD22238E9500DF7F37 /* SearchFeedDelegate.swift */; }; 847CD6CA232F4CBF00FAC46D /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847CD6C9232F4CBF00FAC46D /* IconView.swift */; }; 847E64A02262783000E00365 /* NSAppleEventDescriptor+UserRecordFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847E64942262782F00E00365 /* NSAppleEventDescriptor+UserRecordFields.swift */; }; @@ -813,7 +813,7 @@ DFB3497A294A962D00BC81AD /* AddAccountListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34979294A962D00BC81AD /* AddAccountListView.swift */; }; DFB34980294B085100BC81AD /* AccountInspectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB3497F294B085100BC81AD /* AccountInspectorView.swift */; }; DFB34988294B447F00BC81AD /* InjectedNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */; }; - DFB3498C294B4CA700BC81AD /* WebFeedInspectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB3498B294B4CA700BC81AD /* WebFeedInspectorView.swift */; }; + DFB3498C294B4CA700BC81AD /* FeedInspectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB3498B294B4CA700BC81AD /* FeedInspectorView.swift */; }; DFB34994294C0E3900BC81AD /* ReaderAPIAddAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34990294C0B2200BC81AD /* ReaderAPIAddAccountView.swift */; }; DFB34996294C4DCB00BC81AD /* LocalizedNetNewsWireError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34995294C4DCB00BC81AD /* LocalizedNetNewsWireError.swift */; }; DFB34997294C4DCB00BC81AD /* LocalizedNetNewsWireError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34995294C4DCB00BC81AD /* LocalizedNetNewsWireError.swift */; }; @@ -1231,7 +1231,7 @@ 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; 519E743422C663F900A78E47 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AddFeedWIndowController.swift; path = AddFeed/AddFeedWIndowController.swift; sourceTree = ""; }; - 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedDefaultContainer.swift; sourceTree = ""; }; + 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddFeedDefaultContainer.swift; sourceTree = ""; }; 51A9A5E32380C8870033AADF /* ShareFolderPickerAccountCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerAccountCell.xib; sourceTree = ""; }; 51A9A5E52380C8B20033AADF /* ShareFolderPickerFolderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerFolderCell.xib; sourceTree = ""; }; 51A9A5E72380CA130033AADF /* ShareFolderPickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerCell.swift; sourceTree = ""; }; @@ -1371,7 +1371,7 @@ 845EE7B01FC2366500854A1F /* StarredFeedDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarredFeedDelegate.swift; sourceTree = ""; }; 845EE7C01FC2488C00854A1F /* SmartFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartFeed.swift; sourceTree = ""; }; 84702AA31FA27AC0006B8943 /* MarkStatusCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkStatusCommand.swift; sourceTree = ""; }; - 8472058020142E8900AD578B /* WebFeedInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebFeedInspectorViewController.swift; sourceTree = ""; }; + 8472058020142E8900AD578B /* FeedInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedInspectorViewController.swift; sourceTree = ""; }; 847752FE2008879500D93690 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 8477ACBD22238E9500DF7F37 /* SearchFeedDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchFeedDelegate.swift; sourceTree = ""; }; 847CD6C9232F4CBF00FAC46D /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = ""; }; @@ -1614,7 +1614,7 @@ DFB34979294A962D00BC81AD /* AddAccountListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountListView.swift; sourceTree = ""; }; DFB3497F294B085100BC81AD /* AccountInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInspectorView.swift; sourceTree = ""; }; DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InjectedNavigationView.swift; sourceTree = ""; }; - DFB3498B294B4CA700BC81AD /* WebFeedInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebFeedInspectorView.swift; sourceTree = ""; }; + DFB3498B294B4CA700BC81AD /* FeedInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedInspectorView.swift; sourceTree = ""; }; DFB34990294C0B2200BC81AD /* ReaderAPIAddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderAPIAddAccountView.swift; sourceTree = ""; }; DFB34995294C4DCB00BC81AD /* LocalizedNetNewsWireError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizedNetNewsWireError.swift; sourceTree = ""; }; DFB3499D294C5D5000BC81AD /* CloudKitAddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudKitAddAccountView.swift; sourceTree = ""; }; @@ -1908,7 +1908,7 @@ isa = PBXGroup; children = ( DFB3497F294B085100BC81AD /* AccountInspectorView.swift */, - DFB3498B294B4CA700BC81AD /* WebFeedInspectorView.swift */, + DFB3498B294B4CA700BC81AD /* FeedInspectorView.swift */, ); path = Inspector; sourceTree = ""; @@ -2390,7 +2390,7 @@ 849A97561ED9EB0D007D329B /* Extensions */ = { isa = PBXGroup; children = ( - 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */, + 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */, 849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */, 849A97581ED9EB0D007D329B /* ArticleUtilities.swift */, 51F85BF42273625800C787DC /* Bundle-Extensions.swift */, @@ -2546,7 +2546,7 @@ children = ( DF5124D02A230FC100BBAB1F /* Inspector.storyboard */, 84BBB12C20142A4700F054F5 /* InspectorWindowController.swift */, - 8472058020142E8900AD578B /* WebFeedInspectorViewController.swift */, + 8472058020142E8900AD578B /* FeedInspectorViewController.swift */, 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */, 841ABA5F20145EC100980E11 /* BuiltinSmartFeedInspectorViewController.swift */, 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */, @@ -3982,7 +3982,7 @@ 65ED3FF8235DEF6C0081F399 /* ErrorHandler.swift in Sources */, 65ED3FF9235DEF6C0081F399 /* ActivityManager.swift in Sources */, 1710B9142552354E00679C0D /* AddAccountHelpView.swift in Sources */, - 65ED3FFA235DEF6C0081F399 /* WebFeedInspectorViewController.swift in Sources */, + 65ED3FFA235DEF6C0081F399 /* FeedInspectorViewController.swift in Sources */, 65ED3FFB235DEF6C0081F399 /* AccountsReaderAPIWindowController.swift in Sources */, 65ED3FFC235DEF6C0081F399 /* AccountsAddLocalWindowController.swift in Sources */, 514217062921C9DD00963F14 /* Bundle-Extensions.swift in Sources */, @@ -4038,7 +4038,7 @@ 65ED4026235DEF6C0081F399 /* TimelineTableRowView.swift in Sources */, 65ED4027235DEF6C0081F399 /* UnreadIndicatorView.swift in Sources */, DFEB034E2A273BFE00C7573A /* UTType.swift in Sources */, - 51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */, + 51A9A5F22380DE520033AADF /* AddFeedDefaultContainer.swift in Sources */, 65ED4028235DEF6C0081F399 /* ExtractedArticle.swift in Sources */, 65ED4029235DEF6C0081F399 /* DeleteCommand.swift in Sources */, 65ED402A235DEF6C0081F399 /* AddWebFeedWindowController.swift in Sources */, @@ -4145,7 +4145,7 @@ 84CAFCB022BC8C35007694F0 /* FetchRequestOperation.swift in Sources */, DFD406FA291FB5E400C02962 /* SettingsRows.swift in Sources */, DFB3499E294C5D5000BC81AD /* CloudKitAddAccountView.swift in Sources */, - DFB3498C294B4CA700BC81AD /* WebFeedInspectorView.swift in Sources */, + DFB3498C294B4CA700BC81AD /* FeedInspectorView.swift in Sources */, DFB349A0294E87B700BC81AD /* LocalAddAccountView.swift in Sources */, 51EF0F77227716200050506E /* FaviconGenerator.swift in Sources */, 51938DF3231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift in Sources */, @@ -4162,7 +4162,7 @@ 51C4CFF224D37D1F00AF9874 /* Secrets.swift in Sources */, 51C452A022650A1900C03939 /* FeedIconDownloader.swift in Sources */, 51C4529E22650A1900C03939 /* ImageDownloader.swift in Sources */, - 51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */, + 51A66685238075AE00CB272D /* AddFeedDefaultContainer.swift in Sources */, 176813E92564BAE200D98635 /* WidgetDeepLinks.swift in Sources */, 51B5C87723F22B8200032075 /* ExtensionContainers.swift in Sources */, 51C45292226509C800C03939 /* TodayFeedDelegate.swift in Sources */, @@ -4301,7 +4301,7 @@ D57BE6E0204CD35F00D11AAC /* NSScriptCommand+NetNewsWire.swift in Sources */, D553738B20186C20006D8857 /* Article+Scriptability.swift in Sources */, 845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */, - 51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */, + 51A9A5F32380DE530033AADF /* AddFeedDefaultContainer.swift in Sources */, 84702AA41FA27AC0006B8943 /* MarkStatusCommand.swift in Sources */, D5907D7F2004AC00005947E5 /* NSApplication+Scriptability.swift in Sources */, 8405DD9C22153BD7008CE1BF /* NSView-Extensions.swift in Sources */, @@ -4343,7 +4343,7 @@ 8477ACBE22238E9500DF7F37 /* SearchFeedDelegate.swift in Sources */, 51E3EB33229AB02C00645299 /* ErrorHandler.swift in Sources */, 51FE100A234673A00056195D /* ActivityManager.swift in Sources */, - 8472058120142E8900AD578B /* WebFeedInspectorViewController.swift in Sources */, + 8472058120142E8900AD578B /* FeedInspectorViewController.swift in Sources */, 55E15BCC229D65A900D6602A /* AccountsReaderAPIWindowController.swift in Sources */, 5144EA382279FC6200D19003 /* AccountsAddLocalWindowController.swift in Sources */, 84AD1EAA2031617300BC20B7 /* PasteboardFolder.swift in Sources */, diff --git a/Shared/Activity/ActivityManager.swift b/Shared/Activity/ActivityManager.swift index 0ac1574b5..2229ffbd9 100644 --- a/Shared/Activity/ActivityManager.swift +++ b/Shared/Activity/ActivityManager.swift @@ -40,7 +40,7 @@ class ActivityManager { } init() { - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) } func invalidateCurrentActivities() { @@ -54,8 +54,8 @@ class ActivityManager { selectingActivity = makeSelectFeedActivity(feed: feed) - if let webFeed = feed as? Feed { - updateSelectingActivityFeedSearchAttributes(with: webFeed) + if let feed = feed as? Feed { + updateSelectingActivityFeedSearchAttributes(with: feed) } donate(selectingActivity!) @@ -117,8 +117,8 @@ class ActivityManager { } } - for webFeed in account.flattenedFeeds() { - ids.append(contentsOf: identifiers(for: webFeed)) + for feed in account.flattenedFeeds() { + ids.append(contentsOf: identifiers(for: feed)) } CSSearchableIndex.default().deleteSearchableItems(withIdentifiers: ids) @@ -128,31 +128,31 @@ class ActivityManager { var ids = [String]() ids.append(identifier(for: folder)) - for webFeed in folder.flattenedFeeds() { - ids.append(contentsOf: identifiers(for: webFeed)) + for feed in folder.flattenedFeeds() { + ids.append(contentsOf: identifiers(for: feed)) } CSSearchableIndex.default().deleteSearchableItems(withIdentifiers: ids) } - static func cleanUp(_ webFeed: Feed) { - CSSearchableIndex.default().deleteSearchableItems(withIdentifiers: identifiers(for: webFeed)) + static func cleanUp(_ feed: Feed) { + CSSearchableIndex.default().deleteSearchableItems(withIdentifiers: identifiers(for: feed)) } #endif - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { - guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed, let activityFeedId = selectingActivity?.userInfo?[ArticlePathKey.webFeedID] as? String else { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { + guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed, let activityFeedID = selectingActivity?.userInfo?[ArticlePathKey.feedID] as? String else { return } #if os(iOS) - if let article = readingArticle, activityFeedId == article.feedID { + if let article = readingArticle, activityFeedID == article.feedID { updateReadArticleSearchAttributes(with: article) } #endif - if activityFeedId == webFeed.feedID { - updateSelectingActivityFeedSearchAttributes(with: webFeed) + if activityFeedID == feed.feedID { + updateSelectingActivityFeedSearchAttributes(with: feed) } } diff --git a/Shared/Commands/DeleteCommand.swift b/Shared/Commands/DeleteCommand.swift index c8e43c0fe..f6b79d3c3 100644 --- a/Shared/Commands/DeleteCommand.swift +++ b/Shared/Commands/DeleteCommand.swift @@ -98,7 +98,7 @@ private struct SidebarItemSpecifier { private weak var account: Account? private let parentFolder: Folder? private let folder: Folder? - private let webFeed: Feed? + private let feed: Feed? private let path: ContainerPath private let errorHandler: (Error) -> () @@ -118,13 +118,13 @@ private struct SidebarItemSpecifier { self.parentFolder = node.parentFolder() - if let webFeed = node.representedObject as? Feed { - self.webFeed = webFeed + if let feed = node.representedObject as? Feed { + self.feed = feed self.folder = nil - account = webFeed.account + account = feed.account } else if let folder = node.representedObject as? Folder { - self.webFeed = nil + self.feed = nil self.folder = folder account = folder.account } @@ -144,7 +144,7 @@ private struct SidebarItemSpecifier { func delete(completion: @escaping () -> Void) { - if let webFeed = webFeed { + if let feed { guard let container = path.resolveContainer() else { completion() @@ -152,7 +152,7 @@ private struct SidebarItemSpecifier { } BatchUpdate.shared.start() - account?.removeFeed(webFeed, from: container) { result in + account?.removeFeed(feed, from: container) { result in BatchUpdate.shared.end() completion() self.checkResult(result) @@ -172,7 +172,7 @@ private struct SidebarItemSpecifier { func restore() { - if let _ = webFeed { + if let _ = feed { restoreFeed() } else if let _ = folder { @@ -182,7 +182,7 @@ private struct SidebarItemSpecifier { private func restoreFeed() { - guard let account = account, let feed = webFeed, let container = path.resolveContainer() else { + guard let account = account, let feed = feed, let container = path.resolveContainer() else { return } diff --git a/Shared/Extensions/AddWebFeedDefaultContainer.swift b/Shared/Extensions/AddFeedDefaultContainer.swift similarity index 94% rename from Shared/Extensions/AddWebFeedDefaultContainer.swift rename to Shared/Extensions/AddFeedDefaultContainer.swift index 2aa74112f..6bf7fa880 100644 --- a/Shared/Extensions/AddWebFeedDefaultContainer.swift +++ b/Shared/Extensions/AddFeedDefaultContainer.swift @@ -1,5 +1,5 @@ // -// AddWebFeedDefaultContainer.swift +// AddFeedDefaultContainer.swift // NetNewsWire-iOS // // Created by Maurice Parker on 11/16/19. @@ -9,7 +9,7 @@ import Foundation import Account -struct AddWebFeedDefaultContainer { +struct AddFeedDefaultContainer { static var defaultContainer: Container? { diff --git a/Shared/Extensions/ArticleUtilities.swift b/Shared/Extensions/ArticleUtilities.swift index 41bcd0d30..65034a38d 100644 --- a/Shared/Extensions/ArticleUtilities.swift +++ b/Shared/Extensions/ArticleUtilities.swift @@ -116,11 +116,11 @@ extension Article { return IconImageCache.shared.imageForArticle(self) } - func iconImageUrl(webFeed: Feed) -> URL? { + func iconImageUrl(feed: Feed) -> URL? { if let image = iconImage() { let fm = FileManager.default var path = fm.urls(for: .cachesDirectory, in: .userDomainMask)[0] - let feedID = webFeed.feedID.replacingOccurrences(of: "/", with: "_") + let feedID = feed.feedID.replacingOccurrences(of: "/", with: "_") #if os(macOS) path.appendPathComponent(feedID + "_smallIcon.tiff") #else @@ -188,7 +188,7 @@ extension Article { struct ArticlePathKey { static let accountID = "accountID" static let accountName = "accountName" - static let webFeedID = "webFeedID" + static let feedID = "feedID" static let articleID = "articleID" } @@ -198,7 +198,7 @@ extension Article { return [ ArticlePathKey.accountID: accountID, ArticlePathKey.accountName: account?.nameForDisplay ?? "", - ArticlePathKey.webFeedID: feedID, + ArticlePathKey.feedID: feedID, ArticlePathKey.articleID: articleID ] } diff --git a/Shared/Favicons/FaviconDownloader.swift b/Shared/Favicons/FaviconDownloader.swift index e6053c729..fff2bbd9e 100644 --- a/Shared/Favicons/FaviconDownloader.swift +++ b/Shared/Favicons/FaviconDownloader.swift @@ -73,18 +73,18 @@ final class FaviconDownloader: Logging { cache = [Feed: IconImage]() } - func favicon(for webFeed: Feed) -> IconImage? { + func favicon(for feed: Feed) -> IconImage? { assert(Thread.isMainThread) - var homePageURL = webFeed.homePageURL - if let faviconURL = webFeed.faviconURL { + var homePageURL = feed.homePageURL + if let faviconURL = feed.faviconURL { return favicon(with: faviconURL, homePageURL: homePageURL) } if homePageURL == nil { // Base homePageURL off feedURL if needed. Won’t always be accurate, but is good enough. - if let feedURL = URL(string: webFeed.url), let scheme = feedURL.scheme, let host = feedURL.host { + if let feedURL = URL(string: feed.url), let scheme = feedURL.scheme, let host = feedURL.host { homePageURL = scheme + "://" + host + "/" } } @@ -95,16 +95,16 @@ final class FaviconDownloader: Logging { return nil } - func faviconAsIcon(for webFeed: Feed) -> IconImage? { + func faviconAsIcon(for feed: Feed) -> IconImage? { - if let image = cache[webFeed] { + if let image = cache[feed] { return image } - if let iconImage = favicon(for: webFeed), let imageData = iconImage.image.dataRepresentation() { + if let iconImage = favicon(for: feed), let imageData = iconImage.image.dataRepresentation() { if let scaledImage = RSImage.scaledForIcon(imageData) { let scaledIconImage = IconImage(scaledImage) - cache[webFeed] = scaledIconImage + cache[feed] = scaledIconImage return scaledIconImage } } diff --git a/Shared/Favicons/FaviconGenerator.swift b/Shared/Favicons/FaviconGenerator.swift index dfb632581..7f6c2cd6f 100644 --- a/Shared/Favicons/FaviconGenerator.swift +++ b/Shared/Favicons/FaviconGenerator.swift @@ -14,16 +14,16 @@ final class FaviconGenerator { private static var faviconGeneratorCache = [String: IconImage]() // feedURL: RSImage - static func favicon(_ webFeed: Feed) -> IconImage { + static func favicon(_ feed: Feed) -> IconImage { - if let favicon = FaviconGenerator.faviconGeneratorCache[webFeed.url] { + if let favicon = FaviconGenerator.faviconGeneratorCache[feed.url] { return favicon } - let colorHash = ColorHash(webFeed.url) + let colorHash = ColorHash(feed.url) if let favicon = AppAssets.faviconTemplateImage.maskWithColor(color: colorHash.color.cgColor) { let iconImage = IconImage(favicon, isBackgroundSupressed: true) - FaviconGenerator.faviconGeneratorCache[webFeed.url] = iconImage + FaviconGenerator.faviconGeneratorCache[feed.url] = iconImage return iconImage } else { return IconImage(AppAssets.faviconTemplateImage, isBackgroundSupressed: true) diff --git a/Shared/IconImageCache.swift b/Shared/IconImageCache.swift index f69dafbdc..16831e7fe 100644 --- a/Shared/IconImageCache.swift +++ b/Shared/IconImageCache.swift @@ -15,7 +15,7 @@ class IconImageCache { static var shared = IconImageCache() private var smartFeedIconImageCache = [ItemIdentifier: IconImage]() - private var webFeedIconImageCache = [ItemIdentifier: IconImage]() + private var feedIconImageCache = [ItemIdentifier: IconImage]() private var faviconImageCache = [ItemIdentifier: IconImage]() private var smallIconImageCache = [ItemIdentifier: IconImage]() private var authorIconImageCache = [Author: IconImage]() @@ -30,18 +30,18 @@ class IconImageCache { return nil } - func imageForFeed(_ feed: FeedProtocol) -> IconImage? { - guard let itemID = feed.itemID else { + func imageForFeed(_ feedProtocol: FeedProtocol) -> IconImage? { + guard let itemID = feedProtocol.itemID else { return nil } - if let smartFeed = feed as? PseudoFeed { + if let smartFeed = feedProtocol as? PseudoFeed { return imageForSmartFeed(smartFeed, itemID) } - if let webFeed = feed as? Feed, let iconImage = imageForWebFeed(webFeed, itemID) { + if let feed = feedProtocol as? Feed, let iconImage = imageForFeed(feed, itemID) { return iconImage } - if let smallIconProvider = feed as? SmallIconProvider { + if let smallIconProvider = feedProtocol as? SmallIconProvider { return imageForSmallIconProvider(smallIconProvider, itemID) } @@ -60,7 +60,7 @@ class IconImageCache { func emptyCache() { smartFeedIconImageCache = [ItemIdentifier: IconImage]() - webFeedIconImageCache = [ItemIdentifier: IconImage]() + feedIconImageCache = [ItemIdentifier: IconImage]() faviconImageCache = [ItemIdentifier: IconImage]() smallIconImageCache = [ItemIdentifier: IconImage]() authorIconImageCache = [Author: IconImage]() @@ -80,18 +80,18 @@ private extension IconImageCache { return nil } - func imageForWebFeed(_ webFeed: Feed, _ itemID: ItemIdentifier) -> IconImage? { - if let iconImage = webFeedIconImageCache[itemID] { + func imageForFeed(_ feed: Feed, _ itemID: ItemIdentifier) -> IconImage? { + if let iconImage = feedIconImageCache[itemID] { return iconImage } - if let iconImage = appDelegate.feedIconDownloader.icon(for: webFeed) { - webFeedIconImageCache[itemID] = iconImage + if let iconImage = appDelegate.feedIconDownloader.icon(for: feed) { + feedIconImageCache[itemID] = iconImage return iconImage } if let faviconImage = faviconImageCache[itemID] { return faviconImage } - if let faviconImage = appDelegate.faviconDownloader.faviconAsIcon(for: webFeed) { + if let faviconImage = appDelegate.faviconDownloader.faviconAsIcon(for: feed) { faviconImageCache[itemID] = faviconImage return faviconImage } diff --git a/Shared/Images/FeedIconDownloader.swift b/Shared/Images/FeedIconDownloader.swift index 653fc918d..911f75022 100644 --- a/Shared/Images/FeedIconDownloader.swift +++ b/Shared/Images/FeedIconDownloader.swift @@ -15,7 +15,7 @@ import RSParser extension Notification.Name { - static let WebFeedIconDidBecomeAvailable = Notification.Name("WebFeedIconDidBecomeAvailableNotification") // UserInfoKey.feed + static let FeedIconDidBecomeAvailable = Notification.Name("FeedIconDidBecomeAvailableNotification") // UserInfoKey.feed } public final class FeedIconDownloader { @@ -180,8 +180,8 @@ private extension FeedIconDownloader { func postFeedIconDidBecomeAvailableNotification(_ feed: Feed) { DispatchQueue.main.async { - let userInfo: [AnyHashable: Any] = [UserInfoKey.webFeed: feed] - NotificationCenter.default.post(name: .WebFeedIconDidBecomeAvailable, object: self, userInfo: userInfo) + let userInfo: [AnyHashable: Any] = [UserInfoKey.feed: feed] + NotificationCenter.default.post(name: .FeedIconDidBecomeAvailable, object: self, userInfo: userInfo) } } diff --git a/Shared/Tree/FeedTreeControllerDelegate.swift b/Shared/Tree/FeedTreeControllerDelegate.swift index a5afa2709..edc789d02 100644 --- a/Shared/Tree/FeedTreeControllerDelegate.swift +++ b/Shared/Tree/FeedTreeControllerDelegate.swift @@ -66,9 +66,9 @@ private extension FeedTreeControllerDelegate { var children = [AnyObject]() - for webFeed in container.topLevelFeeds { - if let itemID = webFeed.itemID, !(!filterExceptions.contains(itemID) && isReadFiltered && webFeed.unreadCount == 0) { - children.append(webFeed) + for feed in container.topLevelFeeds { + if let itemID = feed.itemID, !(!filterExceptions.contains(itemID) && isReadFiltered && feed.unreadCount == 0) { + children.append(feed) } } @@ -100,8 +100,8 @@ private extension FeedTreeControllerDelegate { } func createNode(representedObject: Any, parent: Node) -> Node? { - if let webFeed = representedObject as? Feed { - return createNode(webFeed: webFeed, parent: parent) + if let feed = representedObject as? Feed { + return createNode(feed: feed, parent: parent) } if let folder = representedObject as? Folder { @@ -115,8 +115,8 @@ private extension FeedTreeControllerDelegate { return nil } - func createNode(webFeed: Feed, parent: Node) -> Node { - return parent.createChildNode(webFeed) + func createNode(feed: Feed, parent: Node) -> Node { + return parent.createChildNode(feed) } func createNode(folder: Folder, parent: Node) -> Node { diff --git a/Shared/UserInfoKey.swift b/Shared/UserInfoKey.swift index 1ee5c64dc..ff9b6b8fb 100644 --- a/Shared/UserInfoKey.swift +++ b/Shared/UserInfoKey.swift @@ -11,7 +11,7 @@ import Foundation // Used for state restoration — don’t change the values. struct UserInfoKey { - static let webFeed = "webFeed" + static let feed = "webFeed" static let url = "url" static let articlePath = "articlePath" static let itemIdentifier = "feedIdentifier" diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index 0638b2d31..b04c5d262 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -26,8 +26,8 @@ final class UserNotificationManager: NSObject { } for article in articles { - if !article.status.read, let webFeed = article.feed, webFeed.isNotifyAboutNewArticles ?? false { - sendNotification(webFeed: webFeed, article: article) + if !article.status.read, let feed = article.feed, feed.isNotifyAboutNewArticles ?? false { + sendNotification(feed: feed, article: article) } } } @@ -53,19 +53,19 @@ final class UserNotificationManager: NSObject { private extension UserNotificationManager { - func sendNotification(webFeed: Feed, article: Article) { + func sendNotification(feed: Feed, article: Article) { let content = UNMutableNotificationContent() - content.title = webFeed.nameForDisplay + content.title = feed.nameForDisplay if !ArticleStringFormatter.truncatedTitle(article).isEmpty { content.subtitle = ArticleStringFormatter.truncatedTitle(article) } content.body = ArticleStringFormatter.truncatedSummary(article) - content.threadIdentifier = webFeed.feedID + content.threadIdentifier = feed.feedID content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: AppAssets.notificationSoundBlipFileName)) content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.categoryIdentifier = "NEW_ARTICLE_NOTIFICATION_CATEGORY" - if let attachment = thumbnailAttachment(for: article, webFeed: webFeed) { + if let attachment = thumbnailAttachment(for: article, feed: feed) { content.attachments.append(attachment) } @@ -76,12 +76,12 @@ private extension UserNotificationManager { /// Determine if there is an available icon for the article. This will then move it to the caches directory and make it avialble for the notification. /// - Parameters: /// - article: `Article` - /// - webFeed: `WebFeed` - /// - Returns: A `UNNotifcationAttachment` if an icon is available. Otherwise nil. + /// - feed: `Feed` + /// - Returns: A `UNNotificationAttachment` if an icon is available. Otherwise nil. /// - Warning: In certain scenarios, this will return the `faviconTemplateImage`. - func thumbnailAttachment(for article: Article, webFeed: Feed) -> UNNotificationAttachment? { - if let imageURL = article.iconImageUrl(webFeed: webFeed) { - let thumbnail = try? UNNotificationAttachment(identifier: webFeed.feedID, url: imageURL, options: nil) + func thumbnailAttachment(for article: Article, feed: Feed) -> UNNotificationAttachment? { + if let imageURL = article.iconImageUrl(feed: feed) { + let thumbnail = try? UNNotificationAttachment(identifier: feed.feedID, url: imageURL, options: nil) return thumbnail } return nil diff --git a/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedExists.applescript b/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedExists.applescript index 8eafaad24..098c1ff61 100644 --- a/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedExists.applescript +++ b/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedExists.applescript @@ -1,7 +1,7 @@ -- this script just tests that no error was generated from the script try tell application "NetNewsWire" - exists webFeed 1 of account 1 + exists feed 1 of account 1 end tell on error message return {test_result:false, script_result:message} diff --git a/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedOPML.applescript b/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedOPML.applescript index dc4b422bb..5d28a8604 100644 --- a/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedOPML.applescript +++ b/Tests/NetNewsWireTests/ScriptingTests/scripts/testFeedOPML.applescript @@ -1,7 +1,7 @@ -- this script just tests that no error was generated from the script try tell application "NetNewsWire" - opml representation of webFeed 1 of account 1 + opml representation of feed 1 of account 1 end tell on error message return {test_result:false, script_result:message} diff --git a/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameAndUrlOfEveryFeed.applescript b/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameAndUrlOfEveryFeed.applescript index 7e21f3991..86268914b 100644 --- a/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameAndUrlOfEveryFeed.applescript +++ b/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameAndUrlOfEveryFeed.applescript @@ -1,7 +1,7 @@ -- this script just tests that no error was generated from the script try tell application "NetNewsWire" - {name, url} of every webFeed of every account + {name, url} of every feed of every account end tell on error message return {test_result:false, script_result:message} diff --git a/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameOfAuthors.applescript b/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameOfAuthors.applescript index d88df5b9c..db15bab30 100644 --- a/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameOfAuthors.applescript +++ b/Tests/NetNewsWireTests/ScriptingTests/scripts/testNameOfAuthors.applescript @@ -2,7 +2,7 @@ -- and that the returned list is greater than 0 try tell application "NetNewsWire" - set namesResult to name of every author of every webFeed of every account + set namesResult to name of every author of every feed of every account end tell set test_result to ((count items of namesResult) > 0) on error message diff --git a/Tests/NetNewsWireTests/ScriptingTests/scripts/testTitleOfArticlesWhose.applescript b/Tests/NetNewsWireTests/ScriptingTests/scripts/testTitleOfArticlesWhose.applescript index e4dc74825..256e20c08 100644 --- a/Tests/NetNewsWireTests/ScriptingTests/scripts/testTitleOfArticlesWhose.applescript +++ b/Tests/NetNewsWireTests/ScriptingTests/scripts/testTitleOfArticlesWhose.applescript @@ -1,7 +1,7 @@ -- this script just tests that no error was generated from the script try tell application "NetNewsWire" - title of every article of webFeed "Six Colors" where read is true + title of every article of feed "Six Colors" where read is true end tell on error message return {test_result:false, script_result:message} diff --git a/Tests/NetNewsWireTests/SharingTests.swift b/Tests/NetNewsWireTests/SharingTests.swift index a7b86d17b..8bf755c98 100644 --- a/Tests/NetNewsWireTests/SharingTests.swift +++ b/Tests/NetNewsWireTests/SharingTests.swift @@ -40,10 +40,10 @@ class SharingTests: XCTestCase { private func article(titled title: String) -> Article { let articleId = randomId() - return Article(accountID: randomId(), + return Article(accountID: randomID(), articleID: articleId, - webFeedID: randomId(), - uniqueID: randomId(), + feed: randomID(), + uniqueID: randomID(), title: title, contentHTML: nil, contentText: nil, @@ -58,7 +58,7 @@ class SharingTests: XCTestCase { ) } - private func randomId() -> String { + private func randomID() -> String { return UUID().uuidString } diff --git a/iOS/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index 1c604d08e..0e46b8c30 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -57,7 +57,7 @@ class AddFeedViewController: UITableViewController { nameTextField.text = initialFeedName nameTextField.delegate = self - if let defaultContainer = AddWebFeedDefaultContainer.defaultContainer { + if let defaultContainer = AddFeedDefaultContainer.defaultContainer { container = defaultContainer } else { addButton.isEnabled = false @@ -117,7 +117,7 @@ class AddFeedViewController: UITableViewController { switch result { case .success(let feed): self.dismiss(animated: true) - NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.webFeed: feed]) + NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed]) case .failure(let error): self.addButton.isEnabled = true self.activityIndicator.isHidden = true @@ -145,7 +145,7 @@ class AddFeedViewController: UITableViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.row == 2 { - let navController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddWebFeedFolderNavViewController") as! UINavigationController + let navController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddFeedFolderNavViewController") as! UINavigationController navController.modalPresentationStyle = .currentContext let folderViewController = navController.topViewController as! AddFeedFolderViewController folderViewController.delegate = self @@ -157,13 +157,13 @@ class AddFeedViewController: UITableViewController { } -// MARK: AddWebFeedFolderViewControllerDelegate +// MARK: AddFeedFolderViewControllerDelegate extension AddFeedViewController: AddFeedFolderViewControllerDelegate { func didSelect(container: Container) { self.container = container updateFolderLabel() - AddWebFeedDefaultContainer.saveDefaultContainer(container) + AddFeedDefaultContainer.saveDefaultContainer(container) } } diff --git a/iOS/Add/Base.lproj/Add.storyboard b/iOS/Add/Base.lproj/Add.storyboard index 1803eb4a9..efffc1f2c 100644 --- a/iOS/Add/Base.lproj/Add.storyboard +++ b/iOS/Add/Base.lproj/Add.storyboard @@ -11,7 +11,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -254,7 +254,7 @@ - + diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 7016abb6d..530108f6a 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -69,7 +69,7 @@ class WebViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(currentArticleThemeDidChangeNotification(_:)), name: .CurrentArticleThemeDidChangeNotification, object: nil) @@ -84,7 +84,7 @@ class WebViewController: UIViewController { // MARK: Notifications - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { reloadArticleImage() } @@ -440,8 +440,8 @@ extension WebViewController: WKScriptMessageHandler { case MessageName.imageWasClicked: imageWasClicked(body: message.body as? String) case MessageName.showFeedInspector: - if let webFeed = article?.feed { - coordinator.showFeedInspector(for: webFeed) + if let feed = article?.feed { + coordinator.showFeedInspector(for: feed) } default: return diff --git a/iOS/Inspector/WebFeedInspectorView.swift b/iOS/Inspector/FeedInspectorView.swift similarity index 61% rename from iOS/Inspector/WebFeedInspectorView.swift rename to iOS/Inspector/FeedInspectorView.swift index 62612aeb5..885a148cb 100644 --- a/iOS/Inspector/WebFeedInspectorView.swift +++ b/iOS/Inspector/FeedInspectorView.swift @@ -1,5 +1,5 @@ // -// WebFeedInspectorView.swift +// WebInspectorView.swift // NetNewsWire-iOS // // Created by Stuart Breckenridge on 15/12/2022. @@ -11,58 +11,58 @@ import Account import SafariServices import UserNotifications -struct WebFeedInspectorView: View { +struct FeedInspectorView: View { - var webFeed: Feed! + var feed: Feed! @State private var showHomePage: Bool = false var body: some View { Form { - Section(header: webFeedHeaderView) {} + Section(header: feedHeaderView) {} Section { - TextField(webFeed.nameForDisplay, + TextField(feed.nameForDisplay, text: Binding( - get: { webFeed.name ?? webFeed.nameForDisplay }, - set: { webFeed.name = $0 }), + get: { feed.name ?? feed.nameForDisplay }, + set: { feed.name = $0 }), prompt: nil) - Toggle(isOn: Binding(get: { webFeed.isNotifyAboutNewArticles ?? false }, set: { webFeed.isNotifyAboutNewArticles = $0 })) { + Toggle(isOn: Binding(get: { feed.isNotifyAboutNewArticles ?? false }, set: { feed.isNotifyAboutNewArticles = $0 })) { Text("toggle.title.notify-about-new-articles", comment: "New Article Notifications") } } Section(header: Text("label.text.home-page", comment: "Home Page")) { HStack { - Text(webFeed.homePageURL?.decodedURLString ?? "") + Text(feed.homePageURL?.decodedURLString ?? "") Spacer() Image(uiImage: AppAssets.safariImage) .renderingMode(.template) .foregroundColor(Color(uiColor: AppAssets.primaryAccentColor)) } .onTapGesture { - if webFeed.homePageURL != nil { showHomePage = true } + if feed.homePageURL != nil { showHomePage = true } } } Section(header: Text("label.text.feed-url", comment: "Feed URL")) { - Text(webFeed.url.description) + Text(feed.url.description) } } .navigationBarTitleDisplayMode(.inline) - .navigationTitle(webFeed.nameForDisplay) + .navigationTitle(feed.nameForDisplay) .sheet(isPresented: $showHomePage, onDismiss: nil) { - SafariView(url: URL(string: webFeed.homePageURL!)!) + SafariView(url: URL(string: feed.homePageURL!)!) } .tint(Color(uiColor: AppAssets.primaryAccentColor)) .dismissOnExternalContextLaunch() } - var webFeedHeaderView: some View { + var feedHeaderView: some View { HStack { Spacer() - Image(uiImage: webFeed.smallIcon!.image) + Image(uiImage: feed.smallIcon!.image) .resizable() .aspectRatio(contentMode: .fit) .frame(width: 48, height: 48) @@ -72,8 +72,8 @@ struct WebFeedInspectorView: View { } } -struct WebFeedInspectorView_Previews: PreviewProvider { +struct FeedInspectorView_Previews: PreviewProvider { static var previews: some View { - WebFeedInspectorView() + FeedInspectorView() } } diff --git a/iOS/MasterFeed/MasterFeedViewController+Drag.swift b/iOS/MasterFeed/MasterFeedViewController+Drag.swift index b4b1c88d1..edd63ac34 100644 --- a/iOS/MasterFeed/MasterFeedViewController+Drag.swift +++ b/iOS/MasterFeed/MasterFeedViewController+Drag.swift @@ -14,11 +14,11 @@ import UniformTypeIdentifiers extension MasterFeedViewController: UITableViewDragDelegate { func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { - guard let node = coordinator.nodeFor(indexPath), let webFeed = node.representedObject as? Feed else { + guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed else { return [UIDragItem]() } - let data = webFeed.url.data(using: .utf8) + let data = feed.url.data(using: .utf8) let itemProvider = NSItemProvider() itemProvider.registerDataRepresentation(forTypeIdentifier: UTType.url.identifier, visibility: .ownProcess) { completion in diff --git a/iOS/MasterFeed/MasterFeedViewController+Drop.swift b/iOS/MasterFeed/MasterFeedViewController+Drop.swift index ad43ddd3f..123a69377 100644 --- a/iOS/MasterFeed/MasterFeedViewController+Drop.swift +++ b/iOS/MasterFeed/MasterFeedViewController+Drop.swift @@ -23,7 +23,7 @@ extension MasterFeedViewController: UITableViewDropDelegate { } guard let sourceNode = session.localDragSession?.items.first?.localObject as? Node, - let sourceWebFeed = sourceNode.representedObject as? Feed else { + let sourceFeed = sourceNode.representedObject as? Feed else { return UITableViewDropProposal(operation: .forbidden) } @@ -39,7 +39,7 @@ extension MasterFeedViewController: UITableViewDropDelegate { // We didn't hit the corrected indexPath, but this at least it gets the section right guard let section = destinationIndexPath?.section, let account = coordinator.nodeFor(section)?.representedObject as? Account, - !account.hasChildWebFeed(withURL: sourceWebFeed.url) else { + !account.hasChildFeed(withURL: sourceFeed.url) else { return UITableViewDropProposal(operation: .forbidden) } @@ -58,19 +58,19 @@ extension MasterFeedViewController: UITableViewDropDelegate { // Validate account specific behaviors... if correctDestAccount.behaviors.contains(.disallowFeedInMultipleFolders), - sourceWebFeed.account?.accountID != correctDestAccount.accountID && correctDestAccount.hasFeed(withURL: sourceWebFeed.url) { + sourceFeed.account?.accountID != correctDestAccount.accountID && correctDestAccount.hasFeed(withURL: sourceFeed.url) { return UITableViewDropProposal(operation: .forbidden) } // Determine the correct drop proposal if let correctFolder = correctDestFeed as? Folder { - if correctFolder.hasChildWebFeed(withURL: sourceWebFeed.url) { + if correctFolder.hasChildFeed(withURL: sourceFeed.url) { return UITableViewDropProposal(operation: .forbidden) } else { return UITableViewDropProposal(operation: successOperation, intent: .insertIntoDestinationIndexPath) } } else { - if let parentContainer = correctDestNode.parent?.representedObject as? Container, !parentContainer.hasChildWebFeed(withURL: sourceWebFeed.url) { + if let parentContainer = correctDestNode.parent?.representedObject as? Container, !parentContainer.hasChildFeed(withURL: sourceFeed.url) { return UITableViewDropProposal(operation: successOperation, intent: .insertAtDestinationIndexPath) } else { return UITableViewDropProposal(operation: .forbidden) @@ -114,12 +114,12 @@ extension MasterFeedViewController: UITableViewDropDelegate { } }() - guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? Feed else { return } + guard let destination = destinationContainer, let feed = dragNode.representedObject as? Feed else { return } if source.account == destination.account { - moveFeedInAccount(feed: webFeed, sourceContainer: source, destinationContainer: destination) + moveFeedInAccount(feed: feed, sourceContainer: source, destinationContainer: destination) } else { - copyWebFeedBetweenAccounts(feed: webFeed, sourceContainer: source, destinationContainer: destination) + copyFeedBetweenAccounts(feed: feed, sourceContainer: source, destinationContainer: destination) } } @@ -153,7 +153,7 @@ private extension MasterFeedViewController { } } - func copyWebFeedBetweenAccounts(feed: Feed, sourceContainer: Container, destinationContainer: Container) { + func copyFeedBetweenAccounts(feed: Feed, sourceContainer: Container, destinationContainer: Container) { if let existingFeed = destinationContainer.account?.existingFeed(withURL: feed.url) { @@ -189,7 +189,7 @@ private extension MasterFeedViewController { private extension Container { - func hasChildWebFeed(withURL url: String) -> Bool { + func hasChildFeed(withURL url: String) -> Bool { return topLevelFeeds.contains(where: { $0.url == url }) } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index fd9ac1ab0..33ee05450 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -70,8 +70,8 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil) @@ -143,19 +143,19 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma applyToAvailableCells(configureIcon) } - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { - guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed else { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { + guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else { return } - applyToCellsForRepresentedObject(webFeed, configureIcon(_:_:)) + applyToCellsForRepresentedObject(feed, configureIcon(_:_:)) } - @objc func webFeedSettingDidChange(_ note: Notification) { - guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else { + @objc func feedSettingDidChange(_ note: Notification) { + guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else { return } if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL { - configureCellsForRepresentedObject(webFeed) + configureCellsForRepresentedObject(feed) } } @@ -285,13 +285,13 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma renameAction.backgroundColor = UIColor.systemOrange actions.append(renameAction) - if let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed { + if let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed { let moreTitle = NSLocalizedString("action.title.more", comment: "More") let moreAction = UIContextualAction(style: .normal, title: moreTitle) { [weak self] (action, view, completion) in if let self = self { - let alert = UIAlertController(title: webFeed.nameForDisplay, message: nil, preferredStyle: .actionSheet) + let alert = UIAlertController(title: feed.nameForDisplay, message: nil, preferredStyle: .actionSheet) if let popoverController = alert.popoverPresentationController { popoverController.sourceView = view popoverController.sourceRect = CGRect(x: view.frame.size.width/2, y: view.frame.size.height/2, width: 1, height: 1) @@ -341,7 +341,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma return nil } if feed is Feed { - return makeWebFeedContextMenu(indexPath: indexPath, includeDeleteRename: true) + return makeFeedContextMenu(indexPath: indexPath, includeDeleteRename: true) } else if feed is Folder { return makeFolderContextMenu(indexPath: indexPath) } else if feed is PseudoFeed { @@ -637,11 +637,11 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma var menuItems: [UIAction] = [] - let addWebFeedActionTitle = NSLocalizedString("button.title.add-web-feed", comment: "Add Feed") - let addWebFeedAction = UIAction(title: addWebFeedActionTitle, image: AppAssets.plus) { _ in - self.coordinator.showAddWebFeed() + let addFeedActionTitle = NSLocalizedString("button.title.add-web-feed", comment: "Add Feed") + let addFeedAction = UIAction(title: addFeedActionTitle, image: AppAssets.plus) { _ in + self.coordinator.showAddFeed() } - menuItems.append(addWebFeedAction) + menuItems.append(addFeedAction) let addWebFolderActionTitle = NSLocalizedString("button.title.add-folder", comment: "Add Folder") let addWebFolderAction = UIAction(title: addWebFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in @@ -940,7 +940,7 @@ private extension MasterFeedViewController { coordinator.collapse(node) } - func makeWebFeedContextMenu(indexPath: IndexPath, includeDeleteRename: Bool) -> UIContextMenuConfiguration { + func makeFeedContextMenu(indexPath: IndexPath, includeDeleteRename: Bool) -> UIContextMenuConfiguration { return UIContextMenuConfiguration(identifier: MasterFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [ weak self] suggestedActions in guard let self = self else { return nil } @@ -1062,8 +1062,8 @@ private extension MasterFeedViewController { } func copyFeedPageAction(indexPath: IndexPath) -> UIAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, - let url = URL(string: webFeed.url) else { + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, + let url = URL(string: feed.url) else { return nil } @@ -1075,8 +1075,8 @@ private extension MasterFeedViewController { } func copyFeedPageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, - let url = URL(string: webFeed.url) else { + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, + let url = URL(string: feed.url) else { return nil } @@ -1089,8 +1089,8 @@ private extension MasterFeedViewController { } func copyHomePageAction(indexPath: IndexPath) -> UIAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, - let homePageURL = webFeed.homePageURL, + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, + let homePageURL = feed.homePageURL, let url = URL(string: homePageURL) else { return nil } @@ -1103,8 +1103,8 @@ private extension MasterFeedViewController { } func copyHomePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, - let homePageURL = webFeed.homePageURL, + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, + let homePageURL = feed.homePageURL, let url = URL(string: homePageURL) else { return nil } @@ -1118,9 +1118,9 @@ private extension MasterFeedViewController { } func markAllAsReadAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, - webFeed.unreadCount > 0, - let articles = try? webFeed.fetchArticles(), let contentView = self.tableView.cellForRow(at: indexPath)?.contentView else { + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed, + feed.unreadCount > 0, + let articles = try? feed.fetchArticles(), let contentView = self.tableView.cellForRow(at: indexPath)?.contentView else { return nil } @@ -1157,13 +1157,13 @@ private extension MasterFeedViewController { } func getInfoAction(indexPath: IndexPath) -> UIAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return nil } let title = NSLocalizedString("button.title.get-info", comment: "Get Info") let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in - self?.coordinator.showFeedInspector(for: webFeed) + self?.coordinator.showFeedInspector(for: feed) } return action } @@ -1185,13 +1185,13 @@ private extension MasterFeedViewController { } func getInfoAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { + guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return nil } let title = NSLocalizedString("button.title.get-info", comment: "Get Info") let action = UIAlertAction(title: title, style: .default) { [weak self] action in - self?.coordinator.showFeedInspector(for: webFeed) + self?.coordinator.showFeedInspector(for: feed) completion(true) } return action @@ -1442,8 +1442,8 @@ private extension MasterFeedViewController { return } - if let webFeed = feed as? Feed { - webFeed.rename(to: name) { result in + if let feed = feed as? Feed { + feed.rename(to: name) { result in switch result { case .success: break diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 395d2e5f9..62ef15bff 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -63,7 +63,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) @@ -467,13 +467,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner } } - @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { + @objc func feedIconDidBecomeAvailable(_ note: Notification) { if let titleView = navigationItem.titleView as? MasterTimelineTitleView { titleView.iconView.iconImage = coordinator.timelineIconImage } - guard let feed = note.userInfo?[UserInfoKey.webFeed] as? Feed else { + guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else { return } tableView.indexPathsForVisibleRows?.forEach { indexPath in @@ -898,31 +898,31 @@ private extension MasterTimelineViewController { } func discloseFeedAction(_ article: Article) -> UIAction? { - guard let webFeed = article.feed, - !coordinator.timelineFeedIsEqualTo(webFeed) else { return nil } + guard let feed = article.feed, + !coordinator.timelineFeedIsEqualTo(feed) else { return nil } let title = NSLocalizedString("button.title.go-to-feed.titlecase", comment: "Go To Feed. Use to navigate to the user to the article list for a feed.") let action = UIAction(title: title, image: AppAssets.openInSidebarImage) { [weak self] action in - self?.coordinator.discloseWebFeed(webFeed, animations: [.scroll, .navigation]) + self?.coordinator.discloseFeed(feed, animations: [.scroll, .navigation]) } return action } func discloseFeedAlertAction(_ article: Article, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = article.feed, - !coordinator.timelineFeedIsEqualTo(webFeed) else { return nil } + guard let feed = article.feed, + !coordinator.timelineFeedIsEqualTo(feed) else { return nil } let title = NSLocalizedString("button.title.go-to-feed", comment: "Go To Feed. Use to navigate to the user to the article list for a feed.") let action = UIAlertAction(title: title, style: .default) { [weak self] action in - self?.coordinator.discloseWebFeed(webFeed, animations: [.scroll, .navigation]) + self?.coordinator.discloseFeed(feed, animations: [.scroll, .navigation]) completion(true) } return action } func markAllInFeedAsReadAction(_ article: Article, indexPath: IndexPath) -> UIAction? { - guard let webFeed = article.feed else { return nil } - guard let fetchedArticles = try? webFeed.fetchArticles() else { + guard let feed = article.feed else { return nil } + guard let fetchedArticles = try? feed.fetchArticles() else { return nil } @@ -933,7 +933,7 @@ private extension MasterTimelineViewController { let localizedMenuText = NSLocalizedString("button.title.mark-all-as-read.%@", comment: "Mark All as Read in ”feed”. The variable name is the feed name.") - let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, webFeed.nameForDisplay) as String + let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] action in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in @@ -944,8 +944,8 @@ private extension MasterTimelineViewController { } func markAllInFeedAsReadAlertAction(_ article: Article, indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? { - guard let webFeed = article.feed else { return nil } - guard let fetchedArticles = try? webFeed.fetchArticles() else { + guard let feed = article.feed else { return nil } + guard let fetchedArticles = try? feed.fetchArticles() else { return nil } @@ -955,7 +955,7 @@ private extension MasterTimelineViewController { } let localizedMenuText = NSLocalizedString("button.title.mark-all-as-read.%@", comment: "Mark All as Read in ”feed”. The variable name is the feed name.") - let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, webFeed.nameForDisplay) as String + let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String let cancel = { completion(true) } diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 2c1075634..898047703 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -96,7 +96,7 @@ final class RootSplitViewController: UISplitViewController { } @objc func addNewFeed(_ sender: Any?) { - coordinator.showAddWebFeed() + coordinator.showAddFeed() } @objc func addNewFolder(_ sender: Any?) { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index fa7abf161..930289c11 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -385,7 +385,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { case .readArticle: self.handleReadArticle(activity.userInfo) case .addFeedIntent: - self.showAddWebFeed() + self.showAddFeed() } } } @@ -513,10 +513,10 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { } @objc func userDidAddFeed(_ notification: Notification) { - guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? Feed else { + guard let feed = notification.userInfo?[UserInfoKey.feed] as? Feed else { return } - discloseWebFeed(webFeed, animations: [.scroll, .navigation]) + discloseFeed(feed, animations: [.scroll, .navigation]) } @objc func userDefaultsDidChange(_ note: Notification) { @@ -1127,25 +1127,25 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { return timelineFeed == feed } - func discloseWebFeed(_ webFeed: Feed, initialLoad: Bool = false, animations: Animations = [], completion: (() -> Void)? = nil) { + func discloseFeed(_ feed: Feed, initialLoad: Bool = false, animations: Animations = [], completion: (() -> Void)? = nil) { if isSearching { masterTimelineViewController?.hideSearch() } - guard let account = webFeed.account else { + guard let account = feed.account else { completion?() return } - let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(webFeed) }) + let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(feed) }) markExpanded(account) if let parentFolder = parentFolder { markExpanded(parentFolder) } - if let webFeedFeedID = webFeed.itemID { - self.treeControllerDelegate.addFilterException(webFeedFeedID) + if let feedFeedID = feed.itemID { + self.treeControllerDelegate.addFilterException(feedFeedID) } if let parentFolderFeedID = parentFolder?.itemID { self.treeControllerDelegate.addFilterException(parentFolderFeedID) @@ -1153,7 +1153,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { rebuildBackingStores(initialLoad: initialLoad, completion: { self.treeControllerDelegate.resetFilterExceptions() - self.selectFeed(webFeed, animations: animations, completion: completion) + self.selectFeed(feed, animations: animations, completion: completion) }) } @@ -1184,9 +1184,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { } func showFeedInspector() { - let timelineWebFeed = timelineFeed as? Feed - let articleFeed = currentArticle?.feed - guard let feed = timelineWebFeed ?? articleFeed else { + guard let feed = timelineFeed as? Feed ?? currentArticle?.feed else { return } showFeedInspector(for: feed) @@ -1194,17 +1192,17 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { func showFeedInspector(for feed: Feed) { - let hosting = UIHostingController(rootView: InjectedNavigationView(injectedView: WebFeedInspectorView(webFeed: feed))) + let hosting = UIHostingController(rootView: InjectedNavigationView(injectedView: FeedInspectorView(feed: feed))) rootSplitViewController.present(hosting, animated: true) } - func showAddWebFeed(initialFeed: String? = nil, initialFeedName: String? = nil) { + func showAddFeed(initialFeed: String? = nil, initialFeedName: String? = nil) { // Since Add Feed can be opened from anywhere with a keyboard shortcut, we have to deselect any currently selected feeds selectFeed(nil) - let addNavViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddWebFeedViewControllerNav") as! UINavigationController + let addNavViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddFeedViewControllerNav") as! UINavigationController let addViewController = addNavViewController.topViewController as! AddFeedViewController addViewController.initialFeed = initialFeed @@ -1486,18 +1484,18 @@ private extension SceneCoordinator { }) } - func addToFilterExeptionsIfNecessary(_ feed: FeedProtocol?) { - if isReadFeedsFiltered, let feedID = feed?.itemID { - if feed is SmartFeed { + func addToFilterExeptionsIfNecessary(_ feedProtocol: FeedProtocol?) { + if isReadFeedsFiltered, let feedID = feedProtocol?.itemID { + if feedProtocol is SmartFeed { treeControllerDelegate.addFilterException(feedID) - } else if let folderFeed = feed as? Folder { + } else if let folderFeed = feedProtocol as? Folder { if folderFeed.account?.existingFolder(withID: folderFeed.folderID) != nil { treeControllerDelegate.addFilterException(feedID) } - } else if let webFeed = feed as? Feed { - if webFeed.account?.existingFeed(withFeedID: webFeed.feedID) != nil { + } else if let feed = feedProtocol as? Feed { + if feed.account?.existingFeed(withFeedID: feed.feedID) != nil { treeControllerDelegate.addFilterException(feedID) - addParentFolderToFilterExceptions(webFeed) + addParentFolderToFilterExceptions(feed) } } } @@ -2172,14 +2170,14 @@ private extension SceneCoordinator { } }) - case .feed(let accountID, let webFeedID): + case .feed(let accountID, let feedID): guard let accountNode = findAccountNode(accountID: accountID), let account = accountNode.representedObject as? Account, - let webFeed = account.existingFeed(withFeedID: webFeedID) else { + let feed = account.existingFeed(withFeedID: feedID) else { return } - self.discloseWebFeed(webFeed, initialLoad: true) { + self.discloseFeed(feed, initialLoad: true) { self.masterFeedViewController.focus() } } @@ -2191,7 +2189,7 @@ private extension SceneCoordinator { guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable : Any], let accountID = articlePathUserInfo[ArticlePathKey.accountID] as? String, let accountName = articlePathUserInfo[ArticlePathKey.accountName] as? String, - let webFeedID = articlePathUserInfo[ArticlePathKey.webFeedID] as? String, + let feedID = articlePathUserInfo[ArticlePathKey.feedID] as? String, let articleID = articlePathUserInfo[ArticlePathKey.articleID] as? String, let accountNode = findAccountNode(accountID: accountID, accountName: accountName), let account = accountNode.representedObject as? Account else { @@ -2200,20 +2198,20 @@ private extension SceneCoordinator { exceptionArticleFetcher = SingleArticleFetcher(account: account, articleID: articleID) - if restoreFeedSelection(userInfo, accountID: accountID, webFeedID: webFeedID, articleID: articleID) { + if restoreFeedSelection(userInfo, accountID: accountID, feedID: feedID, articleID: articleID) { return } - guard let webFeed = account.existingFeed(withFeedID: webFeedID) else { + guard let feed = account.existingFeed(withFeedID: feedID) else { return } - discloseWebFeed(webFeed) { + discloseFeed(feed) { self.selectArticleInCurrentFeed(articleID) } } - func restoreFeedSelection(_ userInfo: [AnyHashable : Any], accountID: String, webFeedID: String, articleID: String) -> Bool { + func restoreFeedSelection(_ userInfo: [AnyHashable : Any], accountID: String, feedID: String, articleID: String) -> Bool { guard let itemIdentifierUserInfo = userInfo[UserInfoKey.itemIdentifier] as? [AnyHashable : AnyHashable], let itemIdentifier = ItemIdentifier(userInfo: itemIdentifierUserInfo), let isShowingExtractedArticle = userInfo[UserInfoKey.isShowingExtractedArticle] as? Bool, @@ -2237,7 +2235,7 @@ private extension SceneCoordinator { let found = selectFeedAndArticle(itemIdentifier: itemIdentifier, articleID: articleID, isShowingExtractedArticle: isShowingExtractedArticle, articleWindowScrollY: articleWindowScrollY) if found { treeControllerDelegate.addFilterException(itemIdentifier) - if let webFeedNode = nodeFor(itemID: itemIdentifier), let folder = webFeedNode.parent?.representedObject as? Folder, let folderItemID = folder.itemID { + if let feedNode = nodeFor(itemID: itemIdentifier), let folder = feedNode.parent?.representedObject as? Folder, let folderItemID = folder.itemID { treeControllerDelegate.addFilterException(folderItemID) } } @@ -2266,8 +2264,8 @@ private extension SceneCoordinator { return nil } - func findWebFeedNode(webFeedID: String, beginningAt startingNode: Node) -> Node? { - if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == webFeedID }) { + func findFeedNode(feedID: String, beginningAt startingNode: Node) -> Node? { + if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == feedID }) { return node } return nil diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 1cd4c50bb..8f29c6300 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -117,7 +117,7 @@ import RSCore if urlString.starts(with: "feed:") || urlString.starts(with: "feeds:") { let normalizedURLString = urlString.normalizedURL if normalizedURLString.mayBeURL { - self.coordinator.showAddWebFeed(initialFeed: normalizedURLString, initialFeedName: nil) + self.coordinator.showAddFeed(initialFeed: normalizedURLString, initialFeedName: nil) } } @@ -222,7 +222,7 @@ private extension SceneDelegate { case "com.ranchero.NetNewsWire.ShowSearch": coordinator.showSearch() case "com.ranchero.NetNewsWire.ShowAdd": - coordinator.showAddWebFeed() + coordinator.showAddFeed() default: break } diff --git a/iOS/Settings/New Article Notifications/NewArticleNotificationsView.swift b/iOS/Settings/New Article Notifications/NewArticleNotificationsView.swift index 84558a685..b392274a2 100644 --- a/iOS/Settings/New Article Notifications/NewArticleNotificationsView.swift +++ b/iOS/Settings/New Article Notifications/NewArticleNotificationsView.swift @@ -18,8 +18,8 @@ struct NewArticleNotificationsView: View, Logging { var body: some View { List(activeAccounts, id: \.accountID) { account in Section(header: Text(account.nameForDisplay)) { - ForEach(sortedWebFeedsForAccount(account), id: \.feedID) { feed in - WebFeedToggle(webfeed: feed) + ForEach(sortedFeedsForAccount(account), id: \.feedID) { feed in + FeedToggle(feed: feed) .id(feed.feedID) } } @@ -43,31 +43,31 @@ struct NewArticleNotificationsView: View, Logging { } } }) - .onReceive(NotificationCenter.default.publisher(for: .WebFeedIconDidBecomeAvailable), perform: { notification in - guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? Feed else { return } - webFeed.objectWillChange.send() + .onReceive(NotificationCenter.default.publisher(for: .FeedIconDidBecomeAvailable), perform: { notification in + guard let feed = notification.userInfo?[UserInfoKey.feed] as? Feed else { return } + feed.objectWillChange.send() }) } - private func sortedWebFeedsForAccount(_ account: Account) -> [Feed] { + private func sortedFeedsForAccount(_ account: Account) -> [Feed] { return Array(account.flattenedFeeds()).sorted(by: { $0.nameForDisplay.caseInsensitiveCompare($1.nameForDisplay) == .orderedAscending }) } } -fileprivate struct WebFeedToggle: View { +fileprivate struct FeedToggle: View { - @ObservedObject var webfeed: Feed + @ObservedObject var feed: Feed var body: some View { Toggle(isOn: Binding( - get: { webfeed.isNotifyAboutNewArticles ?? false }, - set: { webfeed.isNotifyAboutNewArticles = $0 })) { + get: { feed.isNotifyAboutNewArticles ?? false }, + set: { feed.isNotifyAboutNewArticles = $0 })) { Label { - Text(webfeed.nameForDisplay) + Text(feed.nameForDisplay) } icon: { - Image(uiImage: IconImageCache.shared.imageFor(webfeed.itemID!)!.image) + Image(uiImage: IconImageCache.shared.imageFor(feed.itemID!)!.image) .resizable() .frame(width: 25, height: 25) .cornerRadius(4)