forked from shadowfacts/Tusker
Add context menu for status action notifications
This commit is contained in:
parent
817ebcb7eb
commit
8723921cec
|
@ -69,6 +69,13 @@ extension MenuPreviewProvider {
|
|||
]
|
||||
}
|
||||
|
||||
func actionsForNotificationGroup(_ group: NotificationGroup) -> [UIAction] {
|
||||
// let notifications = group.notificationIDs.compactMap(MastodonCache.notification(for:))
|
||||
return [
|
||||
// todo: clear notifications option
|
||||
]
|
||||
}
|
||||
|
||||
private func createAction(identifier: String, title: String, systemImageName: String, handler: @escaping UIActionHandler) -> UIAction {
|
||||
return UIAction(title: title, image: UIImage(systemName: systemImageName), identifier: UIAction.Identifier(identifier), discoverabilityTitle: nil, attributes: [], state: .off, handler: handler)
|
||||
}
|
||||
|
|
|
@ -155,9 +155,22 @@ class ActionNotificationGroupTableViewCell: UITableViewCell {
|
|||
|
||||
if selected {
|
||||
let notifications = group.notificationIDs.compactMap(MastodonCache.notification(for:))
|
||||
let accountIDs = notifications.compactMap { $0.account.id }
|
||||
let accountIDs = notifications.map { $0.account.id }
|
||||
delegate?.showStatusActionAccountList(statusID: statusID, accountIDs: accountIDs, action: notifications.first!.kind)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ActionNotificationGroupTableViewCell: MenuPreviewProvider {
|
||||
|
||||
func getPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> PreviewProviders? {
|
||||
return (content: {
|
||||
let accountIDs = self.group.notificationIDs.compactMap(MastodonCache.notification(for:)).map { $0.account.id }
|
||||
return StatusActionAccountListTableViewController(statusID: self.statusID, accountIDs: accountIDs)
|
||||
}, actions: {
|
||||
return self.actionsForNotificationGroup(self.group)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue