Rename Feed to FeedProtocol. (This is part one of renaming WebFeed to Feed.)

This commit is contained in:
Brent Simmons
2023-07-01 12:43:36 -07:00
parent 641e35322c
commit e6e03e0d7a
15 changed files with 49 additions and 49 deletions

View File

@@ -51,7 +51,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
}
guard let correctDestNode = coordinator.nodeFor(correctedIndexPath),
let correctDestFeed = correctDestNode.representedObject as? Feed,
let correctDestFeed = correctDestNode.representedObject as? FeedProtocol,
let correctDestAccount = correctDestFeed.account else {
return UITableViewDropProposal(operation: .forbidden)
}

View File

@@ -332,7 +332,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
}
override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol else {
return nil
}
if feed is WebFeed {
@@ -794,7 +794,7 @@ private extension MasterFeedViewController {
cell.isDisclosureAvailable = false
}
if let feed = node.representedObject as? Feed {
if let feed = node.representedObject as? FeedProtocol {
cell.name = feed.nameForDisplay
cell.unreadCount = feed.unreadCount
cell.itemIsInFolder = false
@@ -821,7 +821,7 @@ private extension MasterFeedViewController {
}
func configureIcon(_ cell: MasterFeedTableViewCell, _ indexPath: IndexPath) {
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed, let feedID = feed.feedID else {
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? FeedProtocol, let feedID = feed.feedID else {
return
}
cell.iconImage = IconImageCache.shared.imageFor(feedID)
@@ -841,8 +841,8 @@ private extension MasterFeedViewController {
func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (MasterFeedTableViewCell, IndexPath) -> Void) {
applyToAvailableCells { (cell, indexPath) in
if let node = coordinator.nodeFor(indexPath),
let representedFeed = representedObject as? Feed,
let candidate = node.representedObject as? Feed,
let representedFeed = representedObject as? FeedProtocol,
let candidate = node.representedObject as? FeedProtocol,
representedFeed.feedID == candidate.feedID {
completion(cell, indexPath)
}
@@ -1169,7 +1169,7 @@ private extension MasterFeedViewController {
}
func markAllAsReadAction(indexPath: IndexPath) -> UIAction? {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol,
let contentView = self.tableView.cellForRow(at: indexPath)?.contentView,
feed.unreadCount > 0 else {
return nil
@@ -1188,7 +1188,7 @@ private extension MasterFeedViewController {
}
func catchUpActionMenu(indexPath: IndexPath) -> UIMenu? {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol,
let contentView = self.tableView.cellForRow(at: indexPath)?.contentView,
feed.unreadCount > 0 else {
return nil
@@ -1396,7 +1396,7 @@ private extension MasterFeedViewController {
func rename(indexPath: IndexPath) {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol else { return }
let formatString = NSLocalizedString("alert.title.rename-feed.%@", comment: "Rename feed. The variable provided is the feed name. In English: Rename “%@”")
let title = NSString.localizedStringWithFormat(formatString as NSString, feed.nameForDisplay) as String
@@ -1450,7 +1450,7 @@ private extension MasterFeedViewController {
}
func delete(indexPath: IndexPath) {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol else { return }
let title: String
let message: String

View File

@@ -42,7 +42,7 @@ struct FeedNode: Hashable {
var feedID: FeedIdentifier
init?(_ node: Node) {
guard let feed = node.representedObject as? Feed else { return nil }
guard let feed = node.representedObject as? FeedProtocol else { return nil }
self.node = node
self.feedID = feed.feedID!
@@ -86,7 +86,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
// Flattened tree structure for the Sidebar
private var shadowTable = [(sectionID: String, feedNodes: [FeedNode])]()
private(set) var preSearchTimelineFeed: Feed?
private(set) var preSearchTimelineFeed: FeedProtocol?
private var lastSearchString = ""
private var lastSearchScope: SearchScope? = nil
private var isSearching: Bool = false
@@ -167,7 +167,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
}
private var exceptionArticleFetcher: ArticleFetcher?
private(set) var timelineFeed: Feed?
private(set) var timelineFeed: FeedProtocol?
var timelineMiddleIndexPath: IndexPath?
@@ -620,7 +620,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
func nodeFor(feedID: FeedIdentifier) -> Node? {
return treeController.rootNode.descendantNode(where: { node in
if let feed = node.representedObject as? Feed {
if let feed = node.representedObject as? FeedProtocol {
return feed.feedID == feedID
} else {
return false
@@ -776,7 +776,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
return indexPathFor(node)
}
func selectFeed(_ feed: Feed?, animations: Animations = [], deselectArticle: Bool = true, completion: (() -> Void)? = nil) {
func selectFeed(_ feed: FeedProtocol?, animations: Animations = [], deselectArticle: Bool = true, completion: (() -> Void)? = nil) {
let indexPath: IndexPath? = {
if let feed = feed, let indexPath = indexPathFor(feed as AnyObject) {
return indexPath
@@ -800,7 +800,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
selectArticle(nil)
}
if let ip = indexPath, let node = nodeFor(ip), let feed = node.representedObject as? Feed {
if let ip = indexPath, let node = nodeFor(ip), let feed = node.representedObject as? FeedProtocol {
self.activityManager.selecting(feed: feed)
self.rootSplitViewController.show(.supplementary)
@@ -1476,7 +1476,7 @@ private extension SceneCoordinator {
articleDictionaryNeedsUpdate = false
}
func ensureFeedIsAvailableToSelect(_ feed: Feed, completion: @escaping () -> Void) {
func ensureFeedIsAvailableToSelect(_ feed: FeedProtocol, completion: @escaping () -> Void) {
addToFilterExeptionsIfNecessary(feed)
addShadowTableToFilterExceptions()
@@ -1486,7 +1486,7 @@ private extension SceneCoordinator {
})
}
func addToFilterExeptionsIfNecessary(_ feed: Feed?) {
func addToFilterExeptionsIfNecessary(_ feed: FeedProtocol?) {
if isReadFeedsFiltered, let feedID = feed?.feedID {
if feed is SmartFeed {
treeControllerDelegate.addFilterException(feedID)
@@ -1503,7 +1503,7 @@ private extension SceneCoordinator {
}
}
func addParentFolderToFilterExceptions(_ feed: Feed) {
func addParentFolderToFilterExceptions(_ feed: FeedProtocol) {
guard let node = treeController.rootNode.descendantNodeRepresentingObject(feed as AnyObject),
let folder = node.parent?.representedObject as? Folder,
let folderFeedID = folder.feedID else {
@@ -1516,7 +1516,7 @@ private extension SceneCoordinator {
func addShadowTableToFilterExceptions() {
for section in shadowTable {
for feedNode in section.feedNodes {
if let feed = feedNode.node.representedObject as? Feed, let feedID = feed.feedID {
if let feed = feedNode.node.representedObject as? FeedProtocol, let feedID = feed.feedID {
treeControllerDelegate.addFilterException(feedID)
}
}
@@ -1648,10 +1648,10 @@ private extension SceneCoordinator {
return ShadowTableChanges(deletes: deletes, inserts: inserts, moves: moves, rowChanges: changes)
}
func shadowTableContains(_ feed: Feed) -> Bool {
func shadowTableContains(_ feed: FeedProtocol) -> Bool {
for section in shadowTable {
for feedNode in section.feedNodes {
if let nodeFeed = feedNode.node.representedObject as? Feed, nodeFeed.feedID == feed.feedID {
if let nodeFeed = feedNode.node.representedObject as? FeedProtocol, nodeFeed.feedID == feed.feedID {
return true
}
}
@@ -1665,7 +1665,7 @@ private extension SceneCoordinator {
}
}
func setTimelineFeed(_ feed: Feed?, animated: Bool, completion: (() -> Void)? = nil) {
func setTimelineFeed(_ feed: FeedProtocol?, animated: Bool, completion: (() -> Void)? = nil) {
timelineFeed = feed
fetchAndReplaceArticlesAsync(animated: animated) {