Add context menu for status action notifications

This commit is contained in:
Shadowfacts 2019-09-06 17:56:45 -04:00
parent 817ebcb7eb
commit 8723921cec
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 22 additions and 2 deletions

View File

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

View File

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