diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 412632c8..18912d00 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -336,6 +336,14 @@ extension TimelineViewController: UICollectionViewDelegate { } } + func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { + return (collectionView.cellForItem(at: indexPath) as? TimelineStatusCollectionViewCell)?.contextMenuConfiguration() + } + + func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { + MenuPreviewHelper.willPerformPreviewAction(animator: animator, presenter: self) + } + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { if isShowingTimelineDescription { removeTimelineDescriptionCell() diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index b1608bcc..3e3cd0f3 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -582,6 +582,17 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti return [UIDragItem(itemProvider: provider)] } + func contextMenuConfiguration() -> UIContextMenuConfiguration? { + guard let status = mastodonController.persistentContainer.status(for: statusID) else { + return nil + } + return UIContextMenuConfiguration { + ConversationTableViewController(for: self.statusID, state: self.statusState.copy(), mastodonController: self.mastodonController) + } actionProvider: { _ in + UIMenu(children: self.delegate!.actionsForStatus(status, sourceView: self)) + } + } + } extension TimelineStatusCollectionViewCell: UIContextMenuInteractionDelegate {