From 71e2f46edeab056d795f581d9aa13a932bb3ee29 Mon Sep 17 00:00:00 2001 From: CMK Date: Mon, 26 Jul 2021 15:17:59 +0800 Subject: [PATCH] fix: profile bio allow custom emoji user interact issue --- .../Profile/Header/View/ProfileHeaderView.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift index eb6e06a04..c45a0f648 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift @@ -440,6 +440,7 @@ extension ProfileHeaderView { bringSubviewToFront(bannerContainerView) bringSubviewToFront(nameContainerStackView) + bioMetaText.textView.delegate = self bioMetaText.textView.linkDelegate = self let avatarImageViewSingleTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer @@ -522,6 +523,19 @@ extension ProfileHeaderView { } } +// MARK: - UITextViewDelegate +extension ProfileHeaderView: UITextViewDelegate { + func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { + switch textView { + case bioMetaText.textView: + return false + default: + assertionFailure() + return true + } + } +} + // MARK: - MetaTextViewDelegate extension ProfileHeaderView: MetaTextViewDelegate { func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) {