mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-30 02:09:20 +00:00
Fixed UI not updated when merging calls into a local conference
This commit is contained in:
parent
29343f8887
commit
ae818507aa
6 changed files with 26 additions and 14 deletions
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
|
|
@ -1,4 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
|
|
|
|||
|
|
@ -540,10 +540,10 @@ class CallActivity : GenericActivity() {
|
|||
}
|
||||
R.id.callsListFragment -> {
|
||||
if (notInConference) {
|
||||
Log.i("$TAG Going calls list fragment to active call fragment")
|
||||
Log.i("$TAG Going from calls list fragment to active call fragment")
|
||||
CallsListFragmentDirections.actionCallsListFragmentToActiveCallFragment()
|
||||
} else {
|
||||
Log.i("$TAG Going calls list fragment to conference fragment")
|
||||
Log.i("$TAG Going from calls list fragment to conference fragment")
|
||||
CallsListFragmentDirections.actionCallsListFragmentToActiveConferenceCallFragment()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ class ConferenceViewModel
|
|||
@WorkerThread
|
||||
fun destroy() {
|
||||
isCurrentCallInConference.postValue(false)
|
||||
|
||||
if (::conference.isInitialized) {
|
||||
conference.removeListener(conferenceListener)
|
||||
participantDevices.value.orEmpty().forEach(ConferenceParticipantDeviceModel::destroy)
|
||||
|
|
@ -307,6 +308,15 @@ class ConferenceViewModel
|
|||
@WorkerThread
|
||||
fun configureFromCall(call: Call) {
|
||||
val conf = call.conference ?: return
|
||||
val confSubject = conf.subjectUtf8.orEmpty()
|
||||
Log.i(
|
||||
"$TAG Configuring conference with subject [$confSubject] from call [${call.callLog.callId}]"
|
||||
)
|
||||
configure(conf)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun configure(conf: Conference) {
|
||||
if (::conference.isInitialized) {
|
||||
conference.removeListener(conferenceListener)
|
||||
}
|
||||
|
|
@ -314,6 +324,7 @@ class ConferenceViewModel
|
|||
isCurrentCallInConference.postValue(true)
|
||||
conference = conf
|
||||
conference.addListener(conferenceListener)
|
||||
val core = conference.core
|
||||
|
||||
val isIn = conference.isIn
|
||||
val state = conf.state
|
||||
|
|
@ -331,9 +342,6 @@ class ConferenceViewModel
|
|||
isConversationAvailable.postValue(chatEnabled)
|
||||
|
||||
val confSubject = conference.subjectUtf8.orEmpty()
|
||||
Log.i(
|
||||
"$TAG Configuring conference with subject [$confSubject] from call [${call.callLog.callId}]"
|
||||
)
|
||||
sipUri.postValue(conference.conferenceAddress?.asStringUriOnly())
|
||||
subject.postValue(confSubject)
|
||||
|
||||
|
|
@ -345,15 +353,16 @@ class ConferenceViewModel
|
|||
}
|
||||
}
|
||||
|
||||
val currentLayout = getCurrentLayout(call)
|
||||
val call = conf.call
|
||||
val currentLayout = if (call == null) AUDIO_ONLY_LAYOUT else getCurrentLayout(call)
|
||||
conferenceLayout.postValue(currentLayout)
|
||||
if (currentLayout == GRID_LAYOUT && screenSharing) {
|
||||
Log.w(
|
||||
"$TAG Conference has a participant sharing its screen, changing layout from mosaic to active speaker"
|
||||
)
|
||||
setNewLayout(ACTIVE_SPEAKER_LAYOUT)
|
||||
} else if (currentLayout == AUDIO_ONLY_LAYOUT) {
|
||||
val defaultLayout = call.core.defaultConferenceLayout.toInt()
|
||||
} else if (call != null && currentLayout == AUDIO_ONLY_LAYOUT) {
|
||||
val defaultLayout = core.defaultConferenceLayout.toInt()
|
||||
if (defaultLayout == Conference.Layout.ActiveSpeaker.toInt()) {
|
||||
Log.w("$TAG Joined conference in audio only layout, switching to active speaker layout")
|
||||
setNewLayout(ACTIVE_SPEAKER_LAYOUT)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class CallsListFragment : GenericCallFragment() {
|
|||
|
||||
model.confirmEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
viewModel.mergeCallsIntoConference()
|
||||
viewModel.mergeCallsIntoConference(callViewModel.conferenceModel)
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.linphone.core.Core
|
|||
import org.linphone.core.CoreListenerStub
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.GenericViewModel
|
||||
import org.linphone.ui.call.conference.viewmodel.ConferenceViewModel
|
||||
import org.linphone.ui.call.model.CallModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
@ -216,7 +217,7 @@ class CallsViewModel
|
|||
}
|
||||
|
||||
@UiThread
|
||||
fun mergeCallsIntoConference() {
|
||||
fun mergeCallsIntoConference(conferenceModel: ConferenceViewModel) {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val callsCount = core.callsNb
|
||||
val defaultAccount = LinphoneUtils.getDefaultAccount()
|
||||
|
|
@ -234,6 +235,9 @@ class CallsViewModel
|
|||
showRedToast(R.string.conference_failed_to_merge_calls_into_conference_toast, R.drawable.warning_circle)
|
||||
} else {
|
||||
conference.addParticipants(core.calls)
|
||||
val firstCall = core.calls.first()
|
||||
conferenceModel.configureFromCall(firstCall)
|
||||
goToActiveCallEvent.postValue(Event(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,11 +154,11 @@ class HistoryViewModel
|
|||
val model = CallLogModel(callLog)
|
||||
callLogModel.postValue(model)
|
||||
|
||||
val conference = callLog.wasConference()
|
||||
isConferenceCallLog.postValue(conference)
|
||||
val isConference = callLog.wasConference()
|
||||
isConferenceCallLog.postValue(isConference)
|
||||
meetingChatRoom = callLog.chatRoom
|
||||
isChatRoomAvailable.postValue(meetingChatRoom != null)
|
||||
if (conference) {
|
||||
if (isConference) {
|
||||
Log.i(
|
||||
"$TAG Conference call log, chat room is ${ if (meetingChatRoom != null) "available" else "not available"}"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue