From 2ed4f44e50f77a8f55bde1b1ff7d59a1f102bee2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 27 Jan 2025 10:38:00 +0100 Subject: [PATCH] Fixed group call missed notification & in-call alert titles --- .../notifications/NotificationsManager.kt | 14 ++++++++++---- .../linphone/ui/main/viewmodel/MainViewModel.kt | 15 ++++++--------- app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index a39aef01d..0e3bd47a3 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -614,10 +614,16 @@ class NotificationsManager Log.i("$TAG Updating missed calls notification count to $missedCallCount") } else { val remoteAddress = call.callLog.remoteAddress - val friend: Friend? = coreContext.contactsManager.findContactByAddress(remoteAddress) - body = context.getString(R.string.notification_missed_call) - .format(friend?.name ?: LinphoneUtils.getDisplayName(remoteAddress)) - Log.i("$TAG Creating missed call notification") + val conferenceInfo = call.callLog.conferenceInfo + body = if (conferenceInfo != null) { + context.getString(R.string.notification_missed_group_call) + .format(conferenceInfo.subject ?: LinphoneUtils.getDisplayName(remoteAddress)) + } else { + val friend: Friend? = coreContext.contactsManager.findContactByAddress(remoteAddress) + context.getString(R.string.notification_missed_call) + .format(friend?.name ?: LinphoneUtils.getDisplayName(remoteAddress)) + } + Log.i("$TAG Creating missed call notification with title [$body]") } val pendingIntent = NavDeepLinkBuilder(context) diff --git a/app/src/main/java/org/linphone/ui/main/viewmodel/MainViewModel.kt b/app/src/main/java/org/linphone/ui/main/viewmodel/MainViewModel.kt index da7391924..b107cd8fb 100644 --- a/app/src/main/java/org/linphone/ui/main/viewmodel/MainViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/viewmodel/MainViewModel.kt @@ -472,17 +472,14 @@ class MainViewModel val currentCall = core.currentCall ?: core.calls.firstOrNull() if (currentCall != null) { val address = currentCall.callLog.remoteAddress - val contact = coreContext.contactsManager.findContactByAddress(address) - val label = if (contact != null) { - contact.name ?: LinphoneUtils.getDisplayName(address) + val conferenceInfo = LinphoneUtils.getConferenceInfoIfAny(currentCall) + val label = if (conferenceInfo != null) { + conferenceInfo.subject ?: LinphoneUtils.getDisplayName(address) } else { - val conferenceInfo = coreContext.core.findConferenceInformationFromUri( - address - ) - conferenceInfo?.subject ?: LinphoneUtils.getDisplayName( - address - ) + val contact = coreContext.contactsManager.findContactByAddress(address) + contact?.name ?: LinphoneUtils.getDisplayName(address) } + Log.i("$TAG Showing single call alert with label [$label]") addAlert(SINGLE_CALL, label) callsStatus.postValue(LinphoneUtils.callStateToString(currentCall.state)) } diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fc1f5669c..c88fb10dc 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -54,6 +54,7 @@ Marquer comme lu Répondre Appel manqué de %s + Appel de groupe manqué : %s %s appels manqués Appel manqué &appName; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d68214cf8..f23abecea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -92,6 +92,7 @@ Mark as read Reply Missed call from %s + Missed group call: %s %s missed calls Missed call &appName;