Rename WebFeedPasteboardWriter to FeedPasteboardWriter.

This commit is contained in:
Brent Simmons
2023-07-02 16:14:20 -07:00
parent e3cddc2bc2
commit bb450ababa
3 changed files with 13 additions and 13 deletions

View File

@@ -74,11 +74,11 @@ struct PasteboardFeed: Hashable {
init?(pasteboardItem: NSPasteboardItem) {
var pasteboardType: NSPasteboard.PasteboardType?
if pasteboardItem.types.contains(WebFeedPasteboardWriter.webFeedUTIInternalType) {
pasteboardType = WebFeedPasteboardWriter.webFeedUTIInternalType
if pasteboardItem.types.contains(FeedPasteboardWriter.webFeedUTIInternalType) {
pasteboardType = FeedPasteboardWriter.webFeedUTIInternalType
}
else if pasteboardItem.types.contains(WebFeedPasteboardWriter.webFeedUTIType) {
pasteboardType = WebFeedPasteboardWriter.webFeedUTIType
else if pasteboardItem.types.contains(FeedPasteboardWriter.webFeedUTIType) {
pasteboardType = FeedPasteboardWriter.webFeedUTIType
}
if let foundType = pasteboardType {
if let feedDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardFeedDictionary {
@@ -156,11 +156,11 @@ struct PasteboardFeed: Hashable {
extension WebFeed: PasteboardWriterOwner {
public var pasteboardWriter: NSPasteboardWriting {
return WebFeedPasteboardWriter(webFeed: self)
return FeedPasteboardWriter(webFeed: self)
}
}
@objc final class WebFeedPasteboardWriter: NSObject, NSPasteboardWriting {
@objc final class FeedPasteboardWriter: NSObject, NSPasteboardWriting {
private let webFeed: WebFeed
static let webFeedUTI = "com.ranchero.webFeed"
@@ -178,7 +178,7 @@ extension WebFeed: PasteboardWriterOwner {
func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] {
return [WebFeedPasteboardWriter.webFeedUTIType, .URL, .string, WebFeedPasteboardWriter.webFeedUTIInternalType]
return [FeedPasteboardWriter.webFeedUTIType, .URL, .string, FeedPasteboardWriter.webFeedUTIInternalType]
}
func pasteboardPropertyList(forType type: NSPasteboard.PasteboardType) -> Any? {
@@ -190,9 +190,9 @@ extension WebFeed: PasteboardWriterOwner {
plist = webFeed.nameForDisplay
case .URL:
plist = webFeed.url
case WebFeedPasteboardWriter.webFeedUTIType:
case FeedPasteboardWriter.webFeedUTIType:
plist = exportDictionary
case WebFeedPasteboardWriter.webFeedUTIInternalType:
case FeedPasteboardWriter.webFeedUTIInternalType:
plist = internalDictionary
default:
plist = nil
@@ -202,7 +202,7 @@ extension WebFeed: PasteboardWriterOwner {
}
}
private extension WebFeedPasteboardWriter {
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)

View File

@@ -48,9 +48,9 @@ import Account
}
// WebFeed objects don't have knowledge of their parent so we inject parent container information
// into WebFeedPasteboardWriter instance and it adds this field to the PasteboardFeed objects it writes.
// 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? WebFeedPasteboardWriter {
if let feedWriter = pasteboardWriter as? FeedPasteboardWriter {
if let parentContainerID = (node.parent?.representedObject as? Folder)?.containerID {
feedWriter.containerID = parentContainerID
pasteboardWriter = feedWriter

View File

@@ -67,7 +67,7 @@ protocol SidebarDelegate: AnyObject {
outlineView.dataSource = dataSource
outlineView.doubleAction = #selector(doubleClickedSidebar(_:))
outlineView.setDraggingSourceOperationMask([.move, .copy], forLocal: true)
outlineView.registerForDraggedTypes([WebFeedPasteboardWriter.webFeedUTIInternalType, WebFeedPasteboardWriter.webFeedUTIType, .URL, .string])
outlineView.registerForDraggedTypes([FeedPasteboardWriter.webFeedUTIInternalType, FeedPasteboardWriter.webFeedUTIType, .URL, .string])
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidInitialize(_:)), name: .UnreadCountDidInitialize, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)