Enable data detectors on main status text view

Tapping detected items doesn't work because it conflicts with our tap
gesture recognizer, but long pressing does
This commit is contained in:
Shadowfacts 2022-07-09 11:25:23 -04:00
parent 5a5364ad3b
commit f96d1d780c
2 changed files with 7 additions and 2 deletions

View File

@ -270,8 +270,9 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
extension ContentTextView: UITextViewDelegate {
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
// disable the text view's link interactions, we handle tapping links ourself with a gesture recognizer
return false
// generally disable the text view's link interactions, we handle tapping links ourself with a gesture recognizer
// the builtin data detectors use the x-apple-data-detectors scheme, and we allow the text view to handle those itself
return URL.scheme == "x-apple-data-detectors"
}
}

View File

@ -50,6 +50,10 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
]
contentTextView.defaultFont = .systemFont(ofSize: 18)
contentTextView.dataDetectorTypes = [.flightNumber, .address, .shipmentTrackingNumber, .phoneNumber]
if #available(iOS 16.0, *) {
contentTextView.dataDetectorTypes.formUnion([.money, .physicalValue])
}
profileDetailContainerView.addInteraction(UIContextMenuInteraction(delegate: self))