Fixed outgoing conference call layout & notifications due to use of remote contact instead of remote address

This commit is contained in:
Sylvain Berfini 2022-05-23 10:49:45 +02:00
parent 24b561ae0a
commit d0870c1dfa
5 changed files with 28 additions and 12 deletions

View file

@ -252,9 +252,7 @@ open class CallData(val call: Call) : GenericContactData(call.remoteAddress) {
conferenceParticipants.value = participantsList
conferenceParticipantsCountLabel.value = coreContext.context.getString(R.string.conference_participants_title, participantsList.size)
} else {
val remoteContact = call.remoteContact
Log.d("[Call] Call's remote contact is $remoteContact")
val conferenceAddress = if (remoteContact != null) coreContext.core.interpretUrl(remoteContact) else null
val conferenceAddress = LinphoneUtils.getConferenceAddress(call)
val conferenceInfo = if (conferenceAddress != null) coreContext.core.findConferenceInformationFromUri(conferenceAddress) else null
if (conferenceInfo != null) {
Log.d("[Call] Found matching conference info with subject: ${conferenceInfo.subject}")

View file

@ -224,9 +224,14 @@ class Api26Compatibility {
val title: String
val person: Person
val remoteContact = call.remoteContact
val conferenceAddress = if (remoteContact != null) coreContext.core.interpretUrl(remoteContact) else null
val conferenceAddress = LinphoneUtils.getConferenceAddress(call)
val conferenceInfo = if (conferenceAddress != null) coreContext.core.findConferenceInformationFromUri(conferenceAddress) else null
if (conferenceInfo != null) {
Log.i("[Notifications Manager] Displaying group call notification with subject ${conferenceInfo.subject}")
} else {
Log.i("[Notifications Manager] No conference info found for remote contact address ${call.remoteAddress} (${call.remoteContact})")
}
if (conferenceInfo == null) {
val contact: Friend? =
coreContext.contactsManager.findContactByAddress(call.remoteAddress)

View file

@ -117,13 +117,12 @@ class Api31Compatibility {
channel: String,
notificationsManager: NotificationsManager
): Notification {
val remoteContact = call.remoteContact
val conferenceAddress = if (remoteContact != null) coreContext.core.interpretUrl(remoteContact) else null
val conferenceAddress = LinphoneUtils.getConferenceAddress(call)
val conferenceInfo = if (conferenceAddress != null) coreContext.core.findConferenceInformationFromUri(conferenceAddress) else null
if (conferenceInfo != null) {
Log.i("[Notifications Manager] Displaying incoming group call notification with subject ${conferenceInfo.subject} and remote contact address $remoteContact")
Log.i("[Notifications Manager] Displaying group call notification with subject ${conferenceInfo.subject}")
} else {
Log.i("[Notifications Manager] No conference info found for remote contact address $remoteContact")
Log.i("[Notifications Manager] No conference info found for remote contact address ${call.remoteAddress} (${call.remoteContact})")
}
val caller = if (conferenceInfo == null) {

View file

@ -74,6 +74,19 @@ class LinphoneUtils {
return cleanAddress
}
fun getConferenceAddress(call: Call): Address? {
val remoteContact = call.remoteContact
val conferenceAddress = if (call.dir == Call.Dir.Incoming) {
if (remoteContact != null)
coreContext.core.interpretUrl(remoteContact)
else
null
} else {
call.remoteAddress
}
return conferenceAddress
}
fun isLimeAvailable(): Boolean {
val core = coreContext.core
return core.limeX3DhAvailable() && core.isLimeX3DhEnabled &&

View file

@ -59,7 +59,7 @@
android:layout_height="0dp"
android:layout_margin="10dp"
android:contentDescription="@null"
android:visibility="@{callsViewModel.currentCallData.remoteConferenceSubject.length > 0 ? View.GONE : View.VISIBLE}"
android:visibility="@{callsViewModel.currentCallData.isConferenceCall ? View.GONE : View.VISIBLE}"
app:layout_constraintBottom_toTopOf="@id/conference_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/voip_contact_avatar_max_size"
@ -75,7 +75,8 @@
android:layout_margin="10dp"
android:contentDescription="@null"
android:src="@drawable/icon_multiple_contacts_avatar"
android:visibility="@{callsViewModel.currentCallData.remoteConferenceSubject.length > 0 ? View.VISIBLE : View.GONE, default=gone}"
android:background="@drawable/generated_avatar_bg"
android:visibility="@{callsViewModel.currentCallData.isConferenceCall ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintBottom_toTopOf="@id/callee_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/voip_contact_avatar_max_size"
@ -107,7 +108,7 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="@{callsViewModel.currentCallData.remoteConferenceSubject.length > 0 ? @string/conference : callsViewModel.currentCallData.displayableAddress, default=`sip:bilbo.baggins@sip.linphone.org`}"
android:text="@{callsViewModel.currentCallData.isConferenceCall ? callsViewModel.currentCallData.remoteConferenceSubject : callsViewModel.currentCallData.displayableAddress, default=`sip:bilbo.baggins@sip.linphone.org`}"
app:layout_constraintBottom_toTopOf="@id/buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"