forked from shadowfacts/Tusker
Add context menu action for deleting lists on iPad
This commit is contained in:
parent
60bf3b2e33
commit
e6a5b899be
|
@ -554,11 +554,22 @@ extension MainSidebarViewController: UICollectionViewDelegate {
|
|||
}
|
||||
activity.displaysAuxiliaryScene = true
|
||||
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { (_) in
|
||||
return UIMenu(children: [
|
||||
var actions: [UIAction] = [
|
||||
UIWindowScene.ActivationAction({ action in
|
||||
return UIWindowScene.ActivationConfiguration(userActivity: activity)
|
||||
}),
|
||||
])
|
||||
]
|
||||
|
||||
if case .list(let list) = item {
|
||||
actions.append(UIAction(title: "Delete List", image: UIImage(systemName: "trash"), attributes: .destructive, handler: { [unowned self] _ in
|
||||
Task {
|
||||
let service = DeleteListService(list: list, mastodonController: self.mastodonController, present: { self.present($0, animated: true) })
|
||||
await service.run()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
return UIMenu(children: actions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue