forked from shadowfacts/Tusker
Add Open in New Window context menu action to sidebar items
This commit is contained in:
parent
667d30a710
commit
fdcd2aa540
|
@ -462,6 +462,21 @@ extension MainSidebarViewController: UICollectionViewDelegate {
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
|
||||
guard #available(iOS 15.0, *),
|
||||
let item = dataSource.itemIdentifier(for: indexPath),
|
||||
let activity = userActivityForItem(item) else {
|
||||
return nil
|
||||
}
|
||||
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { (_) in
|
||||
return UIMenu(children: [
|
||||
UIWindowScene.ActivationAction({ action in
|
||||
return UIWindowScene.ActivationConfiguration(userActivity: activity)
|
||||
}),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MainSidebarViewController: UICollectionViewDragDelegate {
|
||||
|
|
Loading…
Reference in New Issue