From 31826d5b43e2a9e96cd243fc29831f9a96e42168 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 Jan 2023 15:13:45 +0100 Subject: [PATCH] Display voice recording default message instead of file name, like for conference invitations --- .../org/linphone/activities/main/chat/data/ChatRoomData.kt | 4 ++++ .../java/org/linphone/notifications/NotificationsManager.kt | 6 ++++-- app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/linphone/activities/main/chat/data/ChatRoomData.kt b/app/src/main/java/org/linphone/activities/main/chat/data/ChatRoomData.kt index 866a0c982..20ee5621b 100644 --- a/app/src/main/java/org/linphone/activities/main/chat/data/ChatRoomData.kt +++ b/app/src/main/java/org/linphone/activities/main/chat/data/ChatRoomData.kt @@ -165,6 +165,10 @@ class ChatRoomData(private val chatRoom: ChatRoom) : ContactDataInterface { val body = AppUtils.getString(R.string.conference_invitation) builder.append(body) builder.setSpan(StyleSpan(Typeface.ITALIC), builder.length - body.length, builder.length, 0) + } else if (content.isVoiceRecording) { + val body = AppUtils.getString(R.string.chat_message_voice_recording) + builder.append(body) + builder.setSpan(StyleSpan(Typeface.ITALIC), builder.length - body.length, builder.length, 0) } else if (content.isFile || content.isFileTransfer) { builder.append(content.name + " ") } else if (content.isText) { diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index 701edde1f..803db3cef 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -708,9 +708,11 @@ class NotificationsManager(private val context: Context) { val displayName = friend?.name ?: LinphoneUtils.getDisplayName(message.fromAddress) var text = "" - val isConferenceInvite = message.contents.firstOrNull()?.isIcalendar ?: false - text = if (isConferenceInvite) { + val firstContent = message.contents.firstOrNull() + text = if (firstContent?.isIcalendar == true) { AppUtils.getString(R.string.conference_invitation_received_notification) + } else if (firstContent?.isVoiceRecording == true) { + AppUtils.getString(R.string.chat_message_voice_recording_received_notification) } else { message.contents.find { content -> content.isText }?.utf8Text ?: "" } diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index dbb01b960..9701ebc15 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -756,4 +756,6 @@ Envoyer la mise à jour par &appName; Envoyer la mise à jour par courriel Capture sauvegardée : %s + Vous avez reçu un message vocal + Message vocal \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e16cd3e76..481bf9be9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -231,6 +231,8 @@ Message will be deleted Abort Please wait for first download to finish before starting a new one + You have received a voice message + Voice message No recordings