diff --git a/ios/MullvadVPN/Views/InfoHeaderView.swift b/ios/MullvadVPN/Views/InfoHeaderView.swift index 67564bc312a0..59782ec13052 100644 --- a/ios/MullvadVPN/Views/InfoHeaderView.swift +++ b/ios/MullvadVPN/Views/InfoHeaderView.swift @@ -23,7 +23,6 @@ class InfoHeaderView: UIView, UITextViewDelegate { super.init(frame: .zero) textView.backgroundColor = .clear - textView.dataDetectorTypes = .link textView.isSelectable = true textView.isEditable = false textView.isScrollEnabled = false @@ -32,11 +31,13 @@ class InfoHeaderView: UIView, UITextViewDelegate { textView.attributedText = makeAttributedString() textView.linkTextAttributes = defaultLinkAttributes textView.textContainer.lineFragmentPadding = 0 + textView.isSelectable = false textView.delegate = self directionalLayoutMargins = .zero addSubviews() + addTapGestureRecognizer() } required init?(coder: NSCoder) { @@ -78,29 +79,13 @@ class InfoHeaderView: UIView, UITextViewDelegate { } } - func textView( - _ textView: UITextView, - shouldInteractWith URL: URL, - in characterRange: NSRange, - interaction: UITextItemInteraction - ) -> Bool { - onAbout?() - return false - } - - @available(iOS 17.0, *) - func textView(_ textView: UITextView, menuConfigurationFor textItem: UITextItem, defaultMenu: UIMenu) -> UITextItem - .MenuConfiguration? { - return nil + private func addTapGestureRecognizer() { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTextViewTap)) + textView.addGestureRecognizer(tapGesture) } - @available(iOS 17.0, *) - func textView(_ textView: UITextView, primaryActionFor textItem: UITextItem, defaultAction: UIAction) -> UIAction? { - if case .link = textItem.content { - return UIAction { [weak self] _ in - self?.onAbout?() - } - } - return nil + @objc + private func handleTextViewTap() { + onAbout?() } }