Fixed issues when creating group call from scheduler process

This commit is contained in:
Sylvain Berfini 2022-05-19 09:32:00 +02:00
parent 3c2640d4bf
commit 4c809ff7d2
4 changed files with 14 additions and 19 deletions

View file

@ -222,7 +222,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03" implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03"
implementation 'androidx.core:core-splashscreen:1.0.0-beta02' implementation 'androidx.core:core-splashscreen:1.0.0-rc01'
implementation 'androidx.emoji:emoji:1.1.0' implementation 'androidx.emoji:emoji:1.1.0'
implementation 'androidx.emoji:emoji-bundled:1.1.0' implementation 'androidx.emoji:emoji-bundled:1.1.0'

View file

@ -206,7 +206,7 @@ internal fun ConferenceSchedulingParticipantsListFragment.navigateToSummary() {
} }
} }
internal fun ConferenceSchedulingSummaryFragment.goToScheduledConferences() { internal fun ConferenceSchedulingSummaryFragment.navigateToScheduledConferences() {
if (findNavController().currentDestination?.id == R.id.conferenceSchedulingSummaryFragment) { if (findNavController().currentDestination?.id == R.id.conferenceSchedulingSummaryFragment) {
findNavController().navigate( findNavController().navigate(
R.id.action_global_scheduledConferencesFragment, R.id.action_global_scheduledConferencesFragment,
@ -216,15 +216,10 @@ internal fun ConferenceSchedulingSummaryFragment.goToScheduledConferences() {
} }
} }
internal fun ConferenceSchedulingSummaryFragment.navigateToConferenceWaitingRoom( internal fun ConferenceSchedulingSummaryFragment.navigateToDialer() {
address: String,
subject: String?
) {
val bundle = Bundle() val bundle = Bundle()
bundle.putString("Address", address)
bundle.putString("Subject", subject)
findMasterNavController().navigate( findMasterNavController().navigate(
R.id.action_global_conferenceWaitingRoomFragment, R.id.action_global_dialerFragment,
bundle, bundle,
popupTo(R.id.dialerFragment, false) popupTo(R.id.dialerFragment, false)
) )

View file

@ -24,10 +24,10 @@ import android.view.View
import androidx.navigation.navGraphViewModels import androidx.navigation.navGraphViewModels
import org.linphone.R import org.linphone.R
import org.linphone.activities.GenericFragment import org.linphone.activities.GenericFragment
import org.linphone.activities.goToScheduledConferences
import org.linphone.activities.main.MainActivity import org.linphone.activities.main.MainActivity
import org.linphone.activities.main.conference.viewmodels.ConferenceSchedulingViewModel import org.linphone.activities.main.conference.viewmodels.ConferenceSchedulingViewModel
import org.linphone.activities.navigateToConferenceWaitingRoom import org.linphone.activities.navigateToDialer
import org.linphone.activities.navigateToScheduledConferences
import org.linphone.databinding.ConferenceSchedulingSummaryFragmentBinding import org.linphone.databinding.ConferenceSchedulingSummaryFragmentBinding
class ConferenceSchedulingSummaryFragment : GenericFragment<ConferenceSchedulingSummaryFragmentBinding>() { class ConferenceSchedulingSummaryFragment : GenericFragment<ConferenceSchedulingSummaryFragmentBinding>() {
@ -53,12 +53,12 @@ class ConferenceSchedulingSummaryFragment : GenericFragment<ConferenceScheduling
viewModel.conferenceCreationCompletedEvent.observe( viewModel.conferenceCreationCompletedEvent.observe(
viewLifecycleOwner viewLifecycleOwner
) { ) {
it.consume { pair -> it.consume {
if (viewModel.scheduleForLater.value == true) { if (viewModel.scheduleForLater.value == true) {
(requireActivity() as MainActivity).showSnackBar(R.string.conference_schedule_info_created) (requireActivity() as MainActivity).showSnackBar(R.string.conference_schedule_info_created)
goToScheduledConferences() navigateToScheduledConferences()
} else { } else {
navigateToConferenceWaitingRoom(pair.first, pair.second) navigateToDialer()
} }
} }
} }

View file

@ -53,8 +53,8 @@ class ConferenceSchedulingViewModel : ContactsSelectionViewModel() {
val conferenceCreationInProgress = MutableLiveData<Boolean>() val conferenceCreationInProgress = MutableLiveData<Boolean>()
val conferenceCreationCompletedEvent: MutableLiveData<Event<Pair<String, String?>>> by lazy { val conferenceCreationCompletedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Pair<String, String?>>>() MutableLiveData<Event<Boolean>>()
} }
val continueEnabled: MediatorLiveData<Boolean> = MediatorLiveData() val continueEnabled: MediatorLiveData<Boolean> = MediatorLiveData()
@ -85,7 +85,7 @@ class ConferenceSchedulingViewModel : ContactsSelectionViewModel() {
address.value = conferenceAddress!! address.value = conferenceAddress!!
if (sendInviteViaChat.value == true) { if (scheduleForLater.value == true && sendInviteViaChat.value == true) {
// Send conference info even when conf is not scheduled for later // Send conference info even when conf is not scheduled for later
// as the conference server doesn't invite participants automatically // as the conference server doesn't invite participants automatically
val chatRoomParams = coreContext.core.createDefaultChatRoomParams() val chatRoomParams = coreContext.core.createDefaultChatRoomParams()
@ -96,7 +96,7 @@ class ConferenceSchedulingViewModel : ContactsSelectionViewModel() {
conferenceScheduler.sendInvitations(chatRoomParams) conferenceScheduler.sendInvitations(chatRoomParams)
} else { } else {
conferenceCreationInProgress.value = false conferenceCreationInProgress.value = false
conferenceCreationCompletedEvent.value = Event(Pair(conferenceAddress.asStringUriOnly(), conferenceScheduler.info?.subject)) conferenceCreationCompletedEvent.value = Event(true)
} }
} else if (state == ConferenceSchedulerState.Error) { } else if (state == ConferenceSchedulerState.Error) {
Log.e("[Conference Creation] Failed to create conference!") Log.e("[Conference Creation] Failed to create conference!")
@ -123,7 +123,7 @@ class ConferenceSchedulingViewModel : ContactsSelectionViewModel() {
if (conferenceAddress == null) { if (conferenceAddress == null) {
Log.e("[Conference Creation] Conference address is null!") Log.e("[Conference Creation] Conference address is null!")
} else { } else {
conferenceCreationCompletedEvent.value = Event(Pair(conferenceAddress.asStringUriOnly(), conferenceScheduler.info?.subject)) conferenceCreationCompletedEvent.value = Event(true)
} }
} }
} }