From dabcae090538c181b92a8c826b1bffbca734edb5 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 13 May 2021 22:25:28 -0400 Subject: [PATCH] Fix being unable to commit previewed profile from timeline status --- .../Status/TimelineStatusTableViewCell.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index 0b56962b..92d826df 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -314,4 +314,19 @@ extension TimelineStatusTableViewCell: UIContextMenuInteractionDelegate { return UIMenu(title: "", image: nil, identifier: nil, options: [], children: self.actionsForProfile(accountID: self.accountID, sourceView: self.avatarImageView)) } } + + func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { + if let viewController = animator.previewViewController, + let delegate = navigationDelegate { + animator.preferredCommitStyle = .pop + animator.addCompletion { + if let customPresenting = viewController as? CustomPreviewPresenting { + customPresenting.presentFromPreview(presenter: delegate) + } else { + delegate.show(viewController) + } + } + } + } + }