Add context menu action for deleting lists on iPad

This commit is contained in:
Shadowfacts 2022-11-11 18:20:16 -05:00
parent 60bf3b2e33
commit e6a5b899be
1 changed files with 13 additions and 2 deletions

View File

@ -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)
}
}
}