Skip to content

Commit

Permalink
disabled drag and drop for searched itemms
Browse files Browse the repository at this point in the history
  • Loading branch information
mul1sh authored and justin-stephenson committed Mar 3, 2021
1 parent aafe1da commit ed2bb13
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions FreeOTP/TokensViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,20 @@ class TokensViewController : UICollectionViewController, UICollectionViewDelegat

// Drag and drop delegate methods
func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
if let token = getTokenAtIndex(tokenIndex: indexPath.row) {
let itemProvider = NSItemProvider(object: token)
// no need for drag and drop when searching
if searchingTokens == false {
if let token = store.load(indexPath.row) {
let itemProvider = NSItemProvider(object: token)

let dragItem = UIDragItem(itemProvider: itemProvider)
return [dragItem]
let dragItem = UIDragItem(itemProvider: itemProvider)
return [dragItem]
} else {
return []
}
} else {
return []
}

}

func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal {
Expand Down

0 comments on commit ed2bb13

Please sign in to comment.