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]
displaytype=MSAndroidTextureDisplay
auto_resize_preview_to_keep_ratio=1
max_mosaic_size=vga
[misc]
enable_basic_to_client_group_chat_room_migration=0

View file

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

View file

@ -33,6 +33,9 @@ import org.linphone.databinding.VoipConferenceParticipantsFragmentBinding
class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipantsFragmentBinding>() {
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 onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -62,7 +65,9 @@ class ConferenceParticipantsFragment : GenericFragment<VoipConferenceParticipant
} else {
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() {
super.onResume()
skipEvents = false
coreContext.core.nativePreviewWindowId = binding.localPreviewVideoSurface
}
override fun onPause() {
super.onPause()
skipEvents = true
}
}

View file

@ -106,9 +106,17 @@ class ConferenceViewModel : ViewModel() {
conference: Conference,
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
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) }
if (participantData != null) {
participantAdminStatusChangedEvent.value = Event(participantData)