Fixed first to join snack displayed multiple times + prevent first admin snack when going to participants list + show admin snack for conference.me as well

This commit is contained in:
Sylvain Berfini 2022-05-09 14:05:03 +02:00
parent 4372fd2d9e
commit 8f8949cb3e
4 changed files with 35 additions and 10 deletions

View file

@ -23,6 +23,7 @@ ec_calibrator_cool_tones=1
[video] [video]
displaytype=MSAndroidTextureDisplay displaytype=MSAndroidTextureDisplay
auto_resize_preview_to_keep_ratio=1 auto_resize_preview_to_keep_ratio=1
max_mosaic_size=vga
[misc] [misc]
enable_basic_to_client_group_chat_room_migration=0 enable_basic_to_client_group_chat_room_migration=0

View file

@ -139,19 +139,23 @@ class ConferenceCallFragment : GenericFragment<VoipConferenceCallFragmentBinding
conferenceViewModel.firstToJoinEvent.observe( conferenceViewModel.firstToJoinEvent.observe(
viewLifecycleOwner viewLifecycleOwner
) { ) {
Snackbar it.consume {
.make(binding.coordinator, R.string.conference_first_to_join, Snackbar.LENGTH_LONG) Snackbar
.setAnchorView(binding.primaryButtons.hangup) .make(binding.coordinator, R.string.conference_first_to_join, Snackbar.LENGTH_LONG)
.show() .setAnchorView(binding.primaryButtons.hangup)
.show()
}
} }
conferenceViewModel.allParticipantsLeftEvent.observe( conferenceViewModel.allParticipantsLeftEvent.observe(
viewLifecycleOwner viewLifecycleOwner
) { ) {
Snackbar it.consume {
.make(binding.coordinator, R.string.conference_last_user, Snackbar.LENGTH_LONG) Snackbar
.setAnchorView(binding.primaryButtons.hangup) .make(binding.coordinator, R.string.conference_last_user, Snackbar.LENGTH_LONG)
.show() .setAnchorView(binding.primaryButtons.hangup)
.show()
}
} }
controlsViewModel.goToConferenceParticipantsListEvent.observe( controlsViewModel.goToConferenceParticipantsListEvent.observe(

View file

@ -33,6 +33,9 @@ import org.linphone.databinding.VoipConferenceParticipantsFragmentBinding
class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipantsFragmentBinding>() { class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipantsFragmentBinding>() {
private val conferenceViewModel: ConferenceViewModel by navGraphViewModels(R.id.call_nav_graph) private val conferenceViewModel: ConferenceViewModel by navGraphViewModels(R.id.call_nav_graph)
// Only display events happening during while this fragment is visible
private var skipEvents = true
override fun getLayoutId(): Int = R.layout.voip_conference_participants_fragment override fun getLayoutId(): Int = R.layout.voip_conference_participants_fragment
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -62,7 +65,9 @@ class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipant
} else { } else {
getString(R.string.conference_admin_unset).format(participantName) getString(R.string.conference_admin_unset).format(participantName)
} }
Toast.makeText(context, message, Toast.LENGTH_SHORT).show() if (!skipEvents) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
}
} }
} }
@ -78,6 +83,13 @@ class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipant
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
skipEvents = false
coreContext.core.nativePreviewWindowId = binding.localPreviewVideoSurface coreContext.core.nativePreviewWindowId = binding.localPreviewVideoSurface
} }
override fun onPause() {
super.onPause()
skipEvents = true
}
} }

View file

@ -106,9 +106,17 @@ class ConferenceViewModel : ViewModel() {
conference: Conference, conference: Conference,
participant: Participant participant: Participant
) { ) {
Log.i("[Conference] Participant admin status changed") Log.i("[Conference] Participant admin status changed [${participant.address.asStringUriOnly()}] is ${if (participant.isAdmin) "now admin" else "no longer admin"}")
isMeAdmin.value = conference.me.isAdmin isMeAdmin.value = conference.me.isAdmin
updateParticipantsList(conference) updateParticipantsList(conference)
if (conference.me.address.weakEqual(participant.address)) {
Log.i("[Conference] Found me participant [${participant.address.asStringUriOnly()}]")
val participantData = ConferenceParticipantData(conference, participant)
participantAdminStatusChangedEvent.value = Event(participantData)
return
}
val participantData = conferenceParticipants.value.orEmpty().find { data -> data.participant.address.weakEqual(participant.address) } val participantData = conferenceParticipants.value.orEmpty().find { data -> data.participant.address.weakEqual(participant.address) }
if (participantData != null) { if (participantData != null) {
participantAdminStatusChangedEvent.value = Event(participantData) participantAdminStatusChangedEvent.value = Event(participantData)