Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jotaemepereira committed Sep 3, 2024
1 parent c0a8067 commit eeff9bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
8 changes: 0 additions & 8 deletions DuckDuckGo/Bookmarks/Model/BookmarkDragDropManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ final class BookmarkDragDropManager {
}
}

func validateDropWhileInSearchMode(_ info: NSDraggingInfo, to destination: Any) -> (destinationFolder: BookmarkFolder?, operation: NSDragOperation) {
if let destinationFolder = destination as? BookmarkFolder {
return (destinationFolder, .move)
}

return (nil, .none)
}

private func validateMove(for draggedBookmarks: Set<PasteboardBookmark>, destination: Any) -> Bool? {
guard !draggedBookmarks.isEmpty else { return nil }
guard destination is BookmarkFolder || destination is PseudoFolder else { return false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ final class BookmarkOutlineViewDataSource: NSObject, BookmarksOutlineViewDataSou

let destination = destinationNode.isRoot ? PseudoFolder.bookmarks : destinationNode.representedObject

if isSearching {
let result = dragDropManager.validateDropWhileInSearchMode(info, to: destination)
self.dragDestinationFolder = result.destinationFolder
return result.operation
guard !isSearching || destination is BookmarkFolder else { return .none }

if let destinationFolder = destination as? BookmarkFolder {
self.dragDestinationFolder = destinationFolder
}

let operation = dragDropManager.validateDrop(info, to: destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,9 @@ extension BookmarkManagementDetailViewController: NSTableViewDelegate, NSTableVi
proposedDropOperation dropOperation: NSTableView.DropOperation) -> NSDragOperation {
let destination = destination(for: dropOperation, at: row)

if isSearching {
let result = dragDropManager.validateDropWhileInSearchMode(info, to: destination)
return result.operation
} else {
return dragDropManager.validateDrop(info, to: destination)
}
guard !isSearching || destination is BookmarkFolder else { return .none }

return dragDropManager.validateDrop(info, to: destination)
}

func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableView.DropOperation) -> Bool {
Expand Down

0 comments on commit eeff9bc

Please sign in to comment.