mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rename WebFeed type to just Feed.
This commit is contained in:
@@ -153,7 +153,7 @@ struct PasteboardFeed: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
extension WebFeed: PasteboardWriterOwner {
|
||||
extension Feed: PasteboardWriterOwner {
|
||||
|
||||
public var pasteboardWriter: NSPasteboardWriting {
|
||||
return FeedPasteboardWriter(webFeed: self)
|
||||
@@ -162,7 +162,7 @@ extension WebFeed: PasteboardWriterOwner {
|
||||
|
||||
@objc final class FeedPasteboardWriter: NSObject, NSPasteboardWriting {
|
||||
|
||||
private let webFeed: WebFeed
|
||||
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"
|
||||
@@ -170,7 +170,7 @@ extension WebFeed: PasteboardWriterOwner {
|
||||
|
||||
var containerID: ContainerIdentifier? = nil
|
||||
|
||||
init(webFeed: WebFeed) {
|
||||
init(webFeed: Feed) {
|
||||
self.webFeed = webFeed
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ extension WebFeed: PasteboardWriterOwner {
|
||||
private extension FeedPasteboardWriter {
|
||||
|
||||
var pasteboardFeed: PasteboardFeed {
|
||||
return PasteboardFeed(url: webFeed.url, feedID: webFeed.webFeedID, homePageURL: webFeed.homePageURL, name: webFeed.name, editedName: webFeed.editedName, accountID: webFeed.account?.accountID, accountType: webFeed.account?.type)
|
||||
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)
|
||||
}
|
||||
|
||||
var exportDictionary: PasteboardFeedDictionary {
|
||||
|
||||
@@ -144,7 +144,7 @@ private extension SidebarOutlineDataSource {
|
||||
// Don’t allow PseudoFeed to be dragged.
|
||||
// This will have to be revisited later. For instance,
|
||||
// user-created smart feeds should be draggable, maybe.
|
||||
return node.representedObject is Folder || node.representedObject is WebFeed
|
||||
return node.representedObject is Folder || node.representedObject is Feed
|
||||
}
|
||||
|
||||
// MARK: - Drag and Drop
|
||||
@@ -257,7 +257,7 @@ private extension SidebarOutlineDataSource {
|
||||
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
|
||||
@@ -315,7 +315,7 @@ private extension SidebarOutlineDataSource {
|
||||
return .copy // different AccountIDs means can only copy
|
||||
}
|
||||
|
||||
func copyWebFeedInAccount(_ feed: WebFeed, _ destination: Container ) {
|
||||
func copyWebFeedInAccount(_ feed: Feed, _ destination: Container ) {
|
||||
destination.account?.addFeed(feed, to: destination) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -326,7 +326,7 @@ private extension SidebarOutlineDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
func moveFeedInAccount(_ feed: WebFeed, _ source: Container, _ destination: Container) {
|
||||
func moveFeedInAccount(_ feed: Feed, _ source: Container, _ destination: Container) {
|
||||
BatchUpdate.shared.start()
|
||||
source.account?.moveFeed(feed, from: source, to: destination) { result in
|
||||
BatchUpdate.shared.end()
|
||||
@@ -339,7 +339,7 @@ private extension SidebarOutlineDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
func copyWebFeedBetweenAccounts(_ feed: WebFeed, _ destinationContainer: Container) {
|
||||
func copyWebFeedBetweenAccounts(_ feed: Feed, _ destinationContainer: Container) {
|
||||
guard let destinationAccount = destinationContainer.account else {
|
||||
return
|
||||
}
|
||||
@@ -514,7 +514,7 @@ private extension SidebarOutlineDataSource {
|
||||
}
|
||||
|
||||
func nodeRepresentsAnyDraggedFeed(_ node: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
|
||||
guard let feed = node.representedObject as? WebFeed else {
|
||||
guard let feed = node.representedObject as? Feed else {
|
||||
return false
|
||||
}
|
||||
for draggedFeed in draggedFeeds {
|
||||
@@ -553,7 +553,7 @@ private extension SidebarOutlineDataSource {
|
||||
return account
|
||||
} else if let folder = node.representedObject as? Folder {
|
||||
return folder.account
|
||||
} else if let webFeed = node.representedObject as? WebFeed {
|
||||
} else if let webFeed = node.representedObject as? Feed {
|
||||
return webFeed.account
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@@ -31,8 +31,8 @@ extension SidebarViewController {
|
||||
let object = objects.first!
|
||||
|
||||
switch object {
|
||||
case is WebFeed:
|
||||
return menuForFeed(object as! WebFeed)
|
||||
case is Feed:
|
||||
return menuForFeed(object as! Feed)
|
||||
case is Folder:
|
||||
return menuForFolder(object as! Folder)
|
||||
case is PseudoFeed:
|
||||
@@ -151,7 +151,7 @@ extension SidebarViewController {
|
||||
|
||||
@objc func renameFromContextualMenu(_ sender: Any?) {
|
||||
|
||||
guard let window = view.window, let menuItem = sender as? NSMenuItem, let object = menuItem.representedObject as? DisplayNameProvider, object is WebFeed || object is Folder else {
|
||||
guard let window = view.window, let menuItem = sender as? NSMenuItem, let object = menuItem.representedObject as? DisplayNameProvider, object is Feed || object is Folder else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ extension SidebarViewController {
|
||||
|
||||
@objc func toggleNotificationsFromContextMenu(_ sender: Any?) {
|
||||
guard let item = sender as? NSMenuItem,
|
||||
let feed = item.representedObject as? WebFeed else {
|
||||
let feed = item.representedObject as? Feed else {
|
||||
return
|
||||
}
|
||||
UNUserNotificationCenter.current().getNotificationSettings { (settings) in
|
||||
@@ -195,7 +195,7 @@ extension SidebarViewController {
|
||||
|
||||
@objc func toggleArticleExtractorFromContextMenu(_ sender: Any?) {
|
||||
guard let item = sender as? NSMenuItem,
|
||||
let feed = item.representedObject as? WebFeed else {
|
||||
let feed = item.representedObject as? Feed else {
|
||||
return
|
||||
}
|
||||
if feed.isArticleExtractorAlwaysOn == nil { feed.isArticleExtractorAlwaysOn = false }
|
||||
@@ -228,7 +228,7 @@ extension SidebarViewController: RenameWindowControllerDelegate {
|
||||
|
||||
func renameWindowController(_ windowController: RenameWindowController, didRenameObject object: Any, withNewName name: String) {
|
||||
|
||||
if let feed = object as? WebFeed {
|
||||
if let feed = object as? Feed {
|
||||
feed.rename(to: name) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -264,7 +264,7 @@ private extension SidebarViewController {
|
||||
return menu
|
||||
}
|
||||
|
||||
func menuForFeed(_ webFeed: WebFeed) -> NSMenu? {
|
||||
func menuForFeed(_ webFeed: Feed) -> NSMenu? {
|
||||
|
||||
let menu = NSMenu(title: "")
|
||||
|
||||
@@ -438,7 +438,7 @@ private extension SidebarViewController {
|
||||
|
||||
func objectIsFeedOrFolder(_ object: Any) -> Bool {
|
||||
|
||||
return object is WebFeed || object is Folder
|
||||
return object is Feed || object is Folder
|
||||
}
|
||||
|
||||
func menuItem(_ title: String, _ action: Selector, _ representedObject: Any) -> NSMenuItem {
|
||||
|
||||
@@ -197,15 +197,15 @@ protocol SidebarDelegate: AnyObject {
|
||||
}
|
||||
|
||||
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
||||
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed else { return }
|
||||
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed else { return }
|
||||
configureCellsForRepresentedObject(webFeed)
|
||||
}
|
||||
|
||||
@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)
|
||||
}
|
||||
}
|
||||
@@ -459,7 +459,7 @@ protocol SidebarDelegate: AnyObject {
|
||||
if isReadFiltered, let itemID = feed.itemID {
|
||||
self.treeControllerDelegate.addFilterException(itemID)
|
||||
|
||||
if let webFeed = feed as? WebFeed, let account = webFeed.account {
|
||||
if let webFeed = feed as? Feed, let account = webFeed.account {
|
||||
let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(webFeed) })
|
||||
if let parentFolderItemID = parentFolder?.itemID {
|
||||
self.treeControllerDelegate.addFilterException(parentFolderItemID)
|
||||
@@ -532,11 +532,11 @@ private extension SidebarViewController {
|
||||
return selectedNodes.first!
|
||||
}
|
||||
|
||||
var singleSelectedWebFeed: WebFeed? {
|
||||
var singleSelectedWebFeed: Feed? {
|
||||
guard let node = singleSelectedNode else {
|
||||
return nil
|
||||
}
|
||||
return node.representedObject as? WebFeed
|
||||
return node.representedObject as? Feed
|
||||
}
|
||||
|
||||
func addAllSelectedToFilterExceptions() {
|
||||
@@ -551,8 +551,8 @@ private extension SidebarViewController {
|
||||
if folderFeed.account?.existingFolder(withID: folderFeed.folderID) != nil {
|
||||
treeControllerDelegate.addFilterException(itemID)
|
||||
}
|
||||
} else if let webFeed = feed as? WebFeed {
|
||||
if webFeed.account?.existingFeed(withFeedID: webFeed.webFeedID) != nil {
|
||||
} else if let webFeed = feed as? Feed {
|
||||
if webFeed.account?.existingFeed(withFeedID: webFeed.feedID) != nil {
|
||||
treeControllerDelegate.addFilterException(itemID)
|
||||
addParentFolderToFilterExceptions(webFeed)
|
||||
}
|
||||
@@ -752,7 +752,7 @@ private extension SidebarViewController {
|
||||
guard let webFeedID = userInfo?[ArticlePathKey.webFeedID] as? String else {
|
||||
return nil
|
||||
}
|
||||
if let node = startingNode.descendantNode(where: { ($0.representedObject as? WebFeed)?.webFeedID == webFeedID }) {
|
||||
if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == webFeedID }) {
|
||||
return node
|
||||
}
|
||||
return nil
|
||||
@@ -779,7 +779,7 @@ private extension SidebarViewController {
|
||||
}
|
||||
|
||||
func imageFor(_ node: Node) -> IconImage? {
|
||||
if let feed = node.representedObject as? WebFeed, let feedIcon = IconImageCache.shared.imageForFeed(feed) {
|
||||
if let feed = node.representedObject as? Feed, let feedIcon = IconImageCache.shared.imageForFeed(feed) {
|
||||
return feedIcon
|
||||
}
|
||||
if let smallIconProvider = node.representedObject as? SmallIconProvider {
|
||||
@@ -869,7 +869,7 @@ private extension Node {
|
||||
if representedObject === object {
|
||||
return true
|
||||
}
|
||||
if let feed1 = object as? WebFeed, let feed2 = representedObject as? WebFeed {
|
||||
if let feed1 = object as? Feed, let feed2 = representedObject as? Feed {
|
||||
return feed1 == feed2
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user