diff --git a/app/src/main/java/org/linphone/activities/voip/data/CallData.kt b/app/src/main/java/org/linphone/activities/voip/data/CallData.kt index 01bffb826..63aa54bd2 100644 --- a/app/src/main/java/org/linphone/activities/voip/data/CallData.kt +++ b/app/src/main/java/org/linphone/activities/voip/data/CallData.kt @@ -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}") diff --git a/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt b/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt index c2ce5398c..b00534e17 100644 --- a/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt +++ b/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt @@ -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) diff --git a/app/src/main/java/org/linphone/compatibility/Api31Compatibility.kt b/app/src/main/java/org/linphone/compatibility/Api31Compatibility.kt index 4205a75a2..22cda4e4b 100644 --- a/app/src/main/java/org/linphone/compatibility/Api31Compatibility.kt +++ b/app/src/main/java/org/linphone/compatibility/Api31Compatibility.kt @@ -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) { diff --git a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt index cc0b5e8b5..ee98601da 100644 --- a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt +++ b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt @@ -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 && diff --git a/app/src/main/res/layout/voip_call_outgoing_fragment.xml b/app/src/main/res/layout/voip_call_outgoing_fragment.xml index a030b9339..a6226f82a 100644 --- a/app/src/main/res/layout/voip_call_outgoing_fragment.xml +++ b/app/src/main/res/layout/voip_call_outgoing_fragment.xml @@ -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"