Re-add timeline context menus

This commit is contained in:
Shadowfacts 2022-10-08 19:16:10 -04:00
parent 164a8e26c4
commit 1b186725ce
2 changed files with 19 additions and 0 deletions

View File

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

View File

@ -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 {