From 49380692f39f2e564797515e18fae335a732922d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 6 Sep 2019 17:59:57 -0400 Subject: [PATCH] Add context menu for follow notifications --- .../FollowNotificationGroupTableViewCell.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tusker/Views/Notifications/FollowNotificationGroupTableViewCell.swift b/Tusker/Views/Notifications/FollowNotificationGroupTableViewCell.swift index 1cc5e268..039e5def 100644 --- a/Tusker/Views/Notifications/FollowNotificationGroupTableViewCell.swift +++ b/Tusker/Views/Notifications/FollowNotificationGroupTableViewCell.swift @@ -130,3 +130,20 @@ class FollowNotificationGroupTableViewCell: UITableViewCell { } } + +extension FollowNotificationGroupTableViewCell: MenuPreviewProvider { + + func getPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> PreviewProviders? { + return (content: { + let accountIDs = self.group.notificationIDs.compactMap(MastodonCache.notification(for:)).map { $0.account.id } + if accountIDs.count == 1 { + return ProfileTableViewController(accountID: accountIDs.first!) + } else { + return AccountListTableViewController(accountIDs: accountIDs) + } + }, actions: { + return self.actionsForNotificationGroup(self.group) + }) + } + +}