Fix preview action on iPad Explore screen not working
This commit is contained in:
parent
e8b7446117
commit
2ea8e9cf1e
|
@ -321,8 +321,17 @@ extension SearchViewController: UICollectionViewDelegate {
|
||||||
UIMenu(children: self.actionsForTrendingLink(card: card))
|
UIMenu(children: self.actionsForTrendingLink(card: card))
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
case let .status(id, state):
|
||||||
fatalError("todo")
|
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)
|
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? {
|
func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, highlightPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview? {
|
||||||
switch dataSource.itemIdentifier(for: indexPath) {
|
switch dataSource.itemIdentifier(for: indexPath) {
|
||||||
case .link(_):
|
case .link(_):
|
||||||
|
|
Loading…
Reference in New Issue