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 1c09388266
commit 2ed4f44e50
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") Log.i("$TAG Updating missed calls notification count to $missedCallCount")
} else { } else {
val remoteAddress = call.callLog.remoteAddress val remoteAddress = call.callLog.remoteAddress
val friend: Friend? = coreContext.contactsManager.findContactByAddress(remoteAddress) val conferenceInfo = call.callLog.conferenceInfo
body = context.getString(R.string.notification_missed_call) body = if (conferenceInfo != null) {
.format(friend?.name ?: LinphoneUtils.getDisplayName(remoteAddress)) context.getString(R.string.notification_missed_group_call)
Log.i("$TAG Creating missed call notification") .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) val pendingIntent = NavDeepLinkBuilder(context)

View file

@ -472,17 +472,14 @@ class MainViewModel
val currentCall = core.currentCall ?: core.calls.firstOrNull() val currentCall = core.currentCall ?: core.calls.firstOrNull()
if (currentCall != null) { if (currentCall != null) {
val address = currentCall.callLog.remoteAddress val address = currentCall.callLog.remoteAddress
val contact = coreContext.contactsManager.findContactByAddress(address) val conferenceInfo = LinphoneUtils.getConferenceInfoIfAny(currentCall)
val label = if (contact != null) { val label = if (conferenceInfo != null) {
contact.name ?: LinphoneUtils.getDisplayName(address) conferenceInfo.subject ?: LinphoneUtils.getDisplayName(address)
} else { } else {
val conferenceInfo = coreContext.core.findConferenceInformationFromUri( val contact = coreContext.contactsManager.findContactByAddress(address)
address contact?.name ?: LinphoneUtils.getDisplayName(address)
)
conferenceInfo?.subject ?: LinphoneUtils.getDisplayName(
address
)
} }
Log.i("$TAG Showing single call alert with label [$label]")
addAlert(SINGLE_CALL, label) addAlert(SINGLE_CALL, label)
callsStatus.postValue(LinphoneUtils.callStateToString(currentCall.state)) 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_mark_message_as_read">Marquer comme lu</string>
<string name="notification_reply_to_message">Répondre</string> <string name="notification_reply_to_message">Répondre</string>
<string name="notification_missed_call">Appel manqué de %s</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_calls">%s appels manqués</string>
<string name="notification_missed_call_title">Appel manqué</string> <string name="notification_missed_call_title">Appel manqué</string>
<string name="notification_push_received_title">&appName;</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_mark_message_as_read">Mark as read</string>
<string name="notification_reply_to_message">Reply</string> <string name="notification_reply_to_message">Reply</string>
<string name="notification_missed_call">Missed call from %s</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_calls">%s missed calls</string>
<string name="notification_missed_call_title">Missed call</string> <string name="notification_missed_call_title">Missed call</string>
<string name="notification_push_received_title">&appName;</string> <string name="notification_push_received_title">&appName;</string>