Made phone numbers & email addresses in chat messages clickable as we did for website URLs & SIP addresses

This commit is contained in:
Sylvain Berfini 2022-06-07 11:24:09 +02:00
parent ec6152c8b8
commit 0b06e22258
2 changed files with 2 additions and 1 deletions

View file

@ -23,6 +23,7 @@ Group changes to describe their impact on the project, as follows:
- Improved how call logs are handled to improve performances
- Improved how contact avatars are generated
- 3-dots menu even for basic chat rooms with more options
- Phone numbers & email addresses are now clickable links in chat messages
### Fixed
- Multiple file download attempt from the same chat bubble at the same time needed app restart to properly download each file

View file

@ -183,7 +183,7 @@ class ChatMessageData(val chatMessage: ChatMessage) : GenericContactData(chatMes
list.add(data)
} else if (content.isText) {
val spannable = Spannable.Factory.getInstance().newSpannable(content.utf8Text?.trim())
LinkifyCompat.addLinks(spannable, Linkify.WEB_URLS)
LinkifyCompat.addLinks(spannable, Linkify.WEB_URLS or Linkify.EMAIL_ADDRESSES or Linkify.PHONE_NUMBERS)
text.value = PatternClickableSpan()
.add(
Pattern.compile("(sips?):([^@]+)(?:@([^ ]+))?"),