Fixes & improvements for incoming group calls

This commit is contained in:
Sylvain Berfini 2024-03-18 10:56:59 +01:00
parent 90a2c0539c
commit 91e0cb5838
6 changed files with 37 additions and 22 deletions

View file

@ -414,6 +414,7 @@ class ContactsManager @UiThread constructor() {
val key = conferenceInfo.uri?.asStringUriOnly()
if (key == null) {
val fakeFriend = coreContext.core.createFriend()
fakeFriend.name = conferenceInfo.subject
return ContactAvatarModel(fakeFriend)
}

View file

@ -783,11 +783,19 @@ class NotificationsManager @MainThread constructor(private val context: Context)
val answerIntent = getCallAnswerPendingIntent(notifiable)
val remoteAddress = call.remoteAddress
val remoteContactAddress = call.remoteContactAddress
val conferenceInfo = if (remoteContactAddress != null) {
call.core.findConferenceInformationFromUri(remoteContactAddress) ?: call.callLog.conferenceInfo
} else {
call.callLog.conferenceInfo
}
val conference = call.conference
val isConference = conference != null
val isConference = conference != null || conferenceInfo != null
val caller = if (conference != null) {
val subject = conference.subject ?: LinphoneUtils.getDisplayName(remoteAddress)
val caller = if (isConference) {
val subject = conferenceInfo?.subject ?: conference?.subject ?: LinphoneUtils.getDisplayName(
remoteAddress
)
Person.Builder()
.setName(subject)
.setIcon(
@ -837,13 +845,10 @@ class NotificationsManager @MainThread constructor(private val context: Context)
)
}
val channel = when (call.state) {
Call.State.IncomingReceived, Call.State.IncomingEarlyMedia -> {
context.getString(R.string.notification_channel_incoming_call_id)
}
else -> {
context.getString(R.string.notification_channel_call_id)
}
val channel = if (isIncoming) {
context.getString(R.string.notification_channel_incoming_call_id)
} else {
context.getString(R.string.notification_channel_call_id)
}
Log.i(

View file

@ -776,7 +776,13 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
callMediaEncryptionModel.update(call)
call.addListener(callListener)
if (call.conference != null) {
val remoteContactAddress = call.remoteContactAddress
val conferenceInfo = if (remoteContactAddress != null) {
call.core.findConferenceInformationFromUri(remoteContactAddress)
} else {
call.callLog.conferenceInfo
}
if (call.conference != null || conferenceInfo != null) {
conferenceModel.configureFromCall(call)
goToConferenceEvent.postValue(Event(true))
} else {
@ -828,7 +834,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val address = call.remoteAddress
displayedAddress.postValue(LinphoneUtils.getAddressAsCleanStringUriOnly(address))
val conferenceInfo = coreContext.core.findConferenceInformationFromUri(address)
val model = if (conferenceInfo != null) {
coreContext.contactsManager.getContactAvatarModelForConferenceInfo(conferenceInfo)
} else {

View file

@ -54,20 +54,18 @@ class CallLogModel @WorkerThread constructor(private val callLog: CallLog) {
wasConference = callLog.wasConference()
if (wasConference) {
val conferenceInfo = coreContext.core.findConferenceInformationFromUri(address)
val conferenceInfo = callLog.conferenceInfo
if (conferenceInfo != null) {
avatarModel = coreContext.contactsManager.getContactAvatarModelForConferenceInfo(
conferenceInfo
)
} else {
Log.w("$TAG Failed to retrieve conference info attached to call log!")
val fakeFriend = coreContext.core.createFriend()
fakeFriend.address = address
fakeFriend.name = LinphoneUtils.getDisplayName(address)
avatarModel = ContactAvatarModel(fakeFriend)
avatarModel.forceConferenceIcon.postValue(true)
Log.w(
"$TAG Call log was conference but failed to find matching conference info from it's URI!"
)
}
friendRefKey = null

View file

@ -27,7 +27,6 @@
android:id="@+id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:visibility="@{model.isSendingVideo || model.isJoining || !model.isInConference ? View.GONE : View.VISIBLE}"
layout="@layout/contact_avatar_medium"
bind:model="@{model.avatarModel}"
@ -120,15 +119,19 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_500"
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
android:text="@{model.name, default=`John Doe`}"
android:textColor="@color/white"
android:textSize="11sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/speaking"

View file

@ -27,7 +27,6 @@
android:id="@+id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:visibility="@{model.isSendingVideo || model.isJoining || !model.isInConference ? View.GONE : View.VISIBLE}"
layout="@layout/contact_avatar_big"
bind:model="@{model.avatarModel}"
@ -120,15 +119,19 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_500"
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
android:text="@{model.name, default=`John Doe`}"
android:textColor="@color/white"
android:textSize="20sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView
android:id="@+id/speaking"