Make the On My Mac account node the drop target when the drop target is otherwise invalid — when dropping nonlocal feeds (URLs, etc. from outside). This way you don’t have to be too precise — you can drag anywhere into the sidebar to add a feed.

This commit is contained in:
Brent Simmons 2018-09-22 14:44:16 -07:00
parent 38b824afca
commit f7ae284b53
1 changed files with 5 additions and 1 deletions

View File

@ -195,10 +195,14 @@ private extension SidebarOutlineDataSource {
}
func ancestorThatCanAcceptNonLocalFeed(_ node: Node) -> Node? {
// Default to the On My Mac account, if needed, so we can always accept a nonlocal feed drop.
if nodeIsDropTarget(node) {
return node
}
guard let parentNode = node.parent else {
if let onMyMacAccountNode = treeController.nodeInTreeRepresentingObject(AccountManager.shared.localAccount) {
return onMyMacAccountNode
}
return nil
}
return ancestorThatCanAcceptNonLocalFeed(parentNode)
@ -208,7 +212,7 @@ private extension SidebarOutlineDataSource {
guard nodeIsDropTarget(parentNode), index == NSOutlineViewDropOnItemIndex else {
return false
}
// Show the add-feed sheet.
let folder = parentNode.representedObject as? Folder
appDelegate.addFeed(draggedFeed.url, name: nil, folder: folder)