diff --git a/Tusker/Screens/Utilities/Previewing.swift b/Tusker/Screens/Utilities/Previewing.swift index 1bd95e2e..ff15df8c 100644 --- a/Tusker/Screens/Utilities/Previewing.swift +++ b/Tusker/Screens/Utilities/Previewing.swift @@ -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) } diff --git a/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift b/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift index 1fbcfffb..4f98d005 100644 --- a/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift +++ b/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift @@ -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) + }) + } + }