Rename WebFeed type to just Feed.

This commit is contained in:
Brent Simmons
2023-07-05 10:02:53 -07:00
parent d5d57a7e30
commit 2f07f4ee16
50 changed files with 393 additions and 393 deletions

View File

@@ -14,7 +14,7 @@ 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? WebFeed else {
guard let node = coordinator.nodeFor(indexPath), let webFeed = node.representedObject as? Feed else {
return [UIDragItem]()
}

View File

@@ -23,7 +23,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
}
guard let sourceNode = session.localDragSession?.items.first?.localObject as? Node,
let sourceWebFeed = sourceNode.representedObject as? WebFeed else {
let sourceWebFeed = sourceNode.representedObject as? Feed else {
return UITableViewDropProposal(operation: .forbidden)
}
@@ -114,7 +114,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
}
}()
guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? WebFeed else { return }
guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? Feed else { return }
if source.account == destination.account {
moveFeedInAccount(feed: webFeed, sourceContainer: source, destinationContainer: destination)
@@ -138,7 +138,7 @@ private extension MasterFeedViewController {
return correctDestination
}
func moveFeedInAccount(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
func moveFeedInAccount(feed: Feed, sourceContainer: Container, destinationContainer: Container) {
guard sourceContainer !== destinationContainer else { return }
BatchUpdate.shared.start()
@@ -153,7 +153,7 @@ private extension MasterFeedViewController {
}
}
func copyWebFeedBetweenAccounts(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
func copyWebFeedBetweenAccounts(feed: Feed, sourceContainer: Container, destinationContainer: Container) {
if let existingFeed = destinationContainer.account?.existingFeed(withURL: feed.url) {

View File

@@ -144,17 +144,17 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
}
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed else {
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed else {
return
}
applyToCellsForRepresentedObject(webFeed, configureIcon(_:_:))
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let webFeed = note.object as? WebFeed, let key = note.userInfo?[WebFeed.FeedSettingUserInfoKey] as? String else {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
if key == WebFeed.FeedSettingKey.homePageURL || key == WebFeed.FeedSettingKey.faviconURL {
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
configureCellsForRepresentedObject(webFeed)
}
}
@@ -285,7 +285,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
renameAction.backgroundColor = UIColor.systemOrange
actions.append(renameAction)
if let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed {
if let webFeed = 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
@@ -340,7 +340,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? FeedProtocol else {
return nil
}
if feed is WebFeed {
if feed is Feed {
return makeWebFeedContextMenu(indexPath: indexPath, includeDeleteRename: true)
} else if feed is Folder {
return makeFolderContextMenu(indexPath: indexPath)
@@ -850,7 +850,7 @@ private extension MasterFeedViewController {
}
func configureIcon(_ cell: MasterFeedTableViewCell, _ indexPath: IndexPath) {
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? FeedProtocol, let feedID = feed.feedID else {
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? FeedProtocol, let feedID = feed.itemID else {
return
}
cell.iconImage = IconImageCache.shared.imageFor(feedID)
@@ -872,7 +872,7 @@ private extension MasterFeedViewController {
if let node = coordinator.nodeFor(indexPath),
let representedFeed = representedObject as? FeedProtocol,
let candidate = node.representedObject as? FeedProtocol,
representedFeed.feedID == candidate.feedID {
representedFeed.itemID == candidate.itemID {
completion(cell, indexPath)
}
}
@@ -906,7 +906,7 @@ private extension MasterFeedViewController {
if let folder = node.representedObject as? Folder {
return folder.account
}
if let feed = node.representedObject as? WebFeed {
if let feed = node.representedObject as? Feed {
return feed.account
}
return nil
@@ -1062,7 +1062,7 @@ private extension MasterFeedViewController {
}
func copyFeedPageAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: webFeed.url) else {
return nil
}
@@ -1075,7 +1075,7 @@ private extension MasterFeedViewController {
}
func copyFeedPageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: webFeed.url) else {
return nil
}
@@ -1089,7 +1089,7 @@ private extension MasterFeedViewController {
}
func copyHomePageAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = webFeed.homePageURL,
let url = URL(string: homePageURL) else {
return nil
@@ -1103,7 +1103,7 @@ private extension MasterFeedViewController {
}
func copyHomePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = webFeed.homePageURL,
let url = URL(string: homePageURL) else {
return nil
@@ -1118,7 +1118,7 @@ private extension MasterFeedViewController {
}
func markAllAsReadAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
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 {
return nil
@@ -1157,7 +1157,7 @@ private extension MasterFeedViewController {
}
func getInfoAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
return nil
}
@@ -1185,7 +1185,7 @@ private extension MasterFeedViewController {
}
func getInfoAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
return nil
}
@@ -1442,7 +1442,7 @@ private extension MasterFeedViewController {
return
}
if let webFeed = feed as? WebFeed {
if let webFeed = feed as? Feed {
webFeed.rename(to: name) { result in
switch result {
case .success:
@@ -1517,7 +1517,7 @@ private extension MasterFeedViewController {
if let folder = deleteNode.representedObject as? Folder {
ActivityManager.cleanUp(folder)
} else if let feed = deleteNode.representedObject as? WebFeed {
} else if let feed = deleteNode.representedObject as? Feed {
ActivityManager.cleanUp(feed)
}