diff --git a/app/src/main/java/org/linphone/ui/call/conference/fragment/ActiveConferenceCallFragment.kt b/app/src/main/java/org/linphone/ui/call/conference/fragment/ActiveConferenceCallFragment.kt index ca7fb648b..017321f4f 100644 --- a/app/src/main/java/org/linphone/ui/call/conference/fragment/ActiveConferenceCallFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/conference/fragment/ActiveConferenceCallFragment.kt @@ -237,6 +237,24 @@ class ActiveConferenceCallFragment : GenericCallFragment() { } } + callViewModel.conferenceModel.goToConversationEvent.observe(viewLifecycleOwner) { + it.consume { pair -> + if (findNavController().currentDestination?.id == R.id.activeConferenceCallFragment) { + val localSipUri = pair.first + val remoteSipUri = pair.second + Log.i( + "$TAG Display conversation with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" + ) + val action = + ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToInCallConversationFragment( + localSipUri, + remoteSipUri + ) + findNavController().navigate(action) + } + } + } + callViewModel.goToCallEvent.observe(viewLifecycleOwner) { it.consume { if (findNavController().currentDestination?.id == R.id.activeConferenceCallFragment) { diff --git a/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt b/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt index 6950789ba..aad1d7c45 100644 --- a/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/conference/viewmodel/ConferenceViewModel.kt @@ -28,6 +28,7 @@ import org.linphone.core.Address import org.linphone.core.Call import org.linphone.core.Conference import org.linphone.core.ConferenceListenerStub +import org.linphone.core.ConferenceParams import org.linphone.core.MediaDirection import org.linphone.core.Participant import org.linphone.core.ParticipantDevice @@ -73,6 +74,8 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() { val isMeAdmin = MutableLiveData() + val isConversationAvailable = MutableLiveData() + val firstParticipantOtherThanOurselvesJoinedEvent: MutableLiveData> by lazy { MutableLiveData>() } @@ -85,6 +88,10 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() { MutableLiveData>>() } + val goToConversationEvent: MutableLiveData>> by lazy { + MutableLiveData>>() + } + private lateinit var conference: Conference private val conferenceListener = object : ConferenceListenerStub() { @@ -248,6 +255,7 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() { init { isPaused.value = false + isConversationAvailable.value = false } @WorkerThread @@ -282,6 +290,9 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() { val screenSharing = conference.screenSharingParticipant != null isScreenSharing.postValue(screenSharing) + val chatEnabled = conference.currentParams.isChatEnabled + isConversationAvailable.postValue(chatEnabled) + val confSubject = conference.subject.orEmpty() Log.i( "$TAG Configuring conference with subject [$confSubject] from call [${call.callLog.callId}]" @@ -307,6 +318,28 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() { } } + @UiThread + fun goToConversation() { + coreContext.postOnCoreThread { core -> + Log.i("$TAG Navigating to conference's conversation") + val chatParams: ConferenceParams? = null + val address = conference.conferenceAddress + val chatRoom = core.searchChatRoom(chatParams, address, null, null) + if (chatRoom != null) { + goToConversationEvent.postValue( + Event( + Pair( + chatRoom.localAddress.asStringUriOnly(), + chatRoom.peerAddress.asStringUriOnly() + ) + ) + ) + } else { + Log.e("$TAG Couldn't find chat room for address [${address?.asStringUriOnly()}]") + } + } + } + @UiThread fun showLayoutMenu() { showLayoutMenuEvent.value = Event(true) diff --git a/app/src/main/java/org/linphone/ui/call/fragment/ConversationFragment.kt b/app/src/main/java/org/linphone/ui/call/fragment/ConversationFragment.kt index 47e0075e2..fe57f972b 100644 --- a/app/src/main/java/org/linphone/ui/call/fragment/ConversationFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/fragment/ConversationFragment.kt @@ -22,6 +22,7 @@ package org.linphone.ui.call.fragment import android.os.Bundle import android.view.View import androidx.navigation.fragment.findNavController +import org.linphone.core.tools.Log import org.linphone.ui.main.chat.fragment.ConversationFragment class ConversationFragment : ConversationFragment() { @@ -32,6 +33,7 @@ class ConversationFragment : ConversationFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + Log.i("$TAG Creating an in-call ConversationFragment") sendMessageViewModel.isInCallConversation.value = true viewModel.isInCallConversation.value = true diff --git a/app/src/main/res/color/in_call_button_tint_color.xml b/app/src/main/res/color/in_call_button_tint_color.xml index e1492132e..1eda9d9d7 100644 --- a/app/src/main/res/color/in_call_button_tint_color.xml +++ b/app/src/main/res/color/in_call_button_tint_color.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/res/layout-land/call_conference_actions_bottom_sheet.xml b/app/src/main/res/layout-land/call_conference_actions_bottom_sheet.xml index 77e4e6e41..2c1664ca6 100644 --- a/app/src/main/res/layout-land/call_conference_actions_bottom_sheet.xml +++ b/app/src/main/res/layout-land/call_conference_actions_bottom_sheet.xml @@ -120,19 +120,39 @@ + + diff --git a/app/src/main/res/layout/call_conference_actions_bottom_sheet.xml b/app/src/main/res/layout/call_conference_actions_bottom_sheet.xml index 80940dd60..9901c51ff 100644 --- a/app/src/main/res/layout/call_conference_actions_bottom_sheet.xml +++ b/app/src/main/res/layout/call_conference_actions_bottom_sheet.xml @@ -120,19 +120,39 @@ + + diff --git a/app/src/main/res/navigation/call_nav_graph.xml b/app/src/main/res/navigation/call_nav_graph.xml index 15ed70513..f72db9565 100644 --- a/app/src/main/res/navigation/call_nav_graph.xml +++ b/app/src/main/res/navigation/call_nav_graph.xml @@ -158,6 +158,12 @@ app:enterAnim="@anim/slide_in" app:popExitAnim="@anim/slide_out" app:launchSingleTop="true" /> +