diff --git a/Tusker/Screens/Search/SearchViewController.swift b/Tusker/Screens/Search/SearchViewController.swift index 2fc4a674..1ce86125 100644 --- a/Tusker/Screens/Search/SearchViewController.swift +++ b/Tusker/Screens/Search/SearchViewController.swift @@ -321,8 +321,17 @@ extension SearchViewController: UICollectionViewDelegate { UIMenu(children: self.actionsForTrendingLink(card: card)) } - default: - fatalError("todo") + case let .status(id, state): + guard let status = mastodonController.persistentContainer.status(for: id) else { + return nil + } + let cell = collectionView.cellForItem(at: indexPath)! + return UIContextMenuConfiguration { + ConversationViewController(for: id, state: state.copy(), mastodonController: self.mastodonController) + } actionProvider: { _ in + UIMenu(children: self.actionsForStatus(status, source: .view(cell))) + } + } } @@ -335,6 +344,10 @@ extension SearchViewController: UICollectionViewDelegate { return self.collectionView(collectionView, contextMenuConfigurationForItemAt: indexPaths[0], point: point) } + func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { + MenuPreviewHelper.willPerformPreviewAction(animator: animator, presenter: self) + } + func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, highlightPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview? { switch dataSource.itemIdentifier(for: indexPath) { case .link(_):