Fixed group call missed notification & in-call alert titles

This commit is contained in:
Sylvain Berfini 2025-01-27 10:38:00 +01:00
parent b4329af83a
commit 6d08625168
4 changed files with 18 additions and 13 deletions

View file

@ -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)

View file

@ -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))
}

View file

@ -54,6 +54,7 @@
<string name="notification_mark_message_as_read">Marquer comme lu</string>
<string name="notification_reply_to_message">Répondre</string>
<string name="notification_missed_call">Appel manqué de %s</string>
<string name="notification_missed_group_call">Appel de groupe manqué : %s</string>
<string name="notification_missed_calls">%s appels manqués</string>
<string name="notification_missed_call_title">Appel manqué</string>
<string name="notification_push_received_title">&appName;</string>

View file

@ -92,6 +92,7 @@
<string name="notification_mark_message_as_read">Mark as read</string>
<string name="notification_reply_to_message">Reply</string>
<string name="notification_missed_call">Missed call from %s</string>
<string name="notification_missed_group_call">Missed group call: %s</string>
<string name="notification_missed_calls">%s missed calls</string>
<string name="notification_missed_call_title">Missed call</string>
<string name="notification_push_received_title">&appName;</string>