From 0b06e222587e4c52daf5dc4892343a59f005242b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 7 Jun 2022 11:24:09 +0200 Subject: [PATCH] Made phone numbers & email addresses in chat messages clickable as we did for website URLs & SIP addresses --- CHANGELOG.md | 1 + .../org/linphone/activities/main/chat/data/ChatMessageData.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca6b4b293..f5a3098d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/src/main/java/org/linphone/activities/main/chat/data/ChatMessageData.kt b/app/src/main/java/org/linphone/activities/main/chat/data/ChatMessageData.kt index 993a74c99..c978f1353 100644 --- a/app/src/main/java/org/linphone/activities/main/chat/data/ChatMessageData.kt +++ b/app/src/main/java/org/linphone/activities/main/chat/data/ChatMessageData.kt @@ -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?):([^@]+)(?:@([^ ]+))?"),