Showing snack bar when you're the first to join a conference or when you're the last one in it

This commit is contained in:
Sylvain Berfini 2022-04-11 11:00:54 +02:00
parent 5fd69bcd4c
commit 2ab24f893a
5 changed files with 40 additions and 3 deletions

View file

@ -56,6 +56,5 @@ class PdfViewerFragment : GenericViewerFragment<FilePdfViewerFragmentBinding>()
adapter = PdfPagesListAdapter(viewModel)
binding.pdfViewPager.adapter = adapter
//adapter.notifyDataSetChanged()
}
}

View file

@ -136,6 +136,24 @@ 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()
}
conferenceViewModel.allParticipantsLeftEvent.observe(
viewLifecycleOwner
) {
Snackbar
.make(binding.coordinator, R.string.conference_last_user, Snackbar.LENGTH_LONG)
.setAnchorView(binding.primaryButtons.hangup)
.show()
}
controlsViewModel.goToConferenceParticipantsListEvent.observe(
viewLifecycleOwner
) {

View file

@ -49,13 +49,21 @@ class ConferenceViewModel : ViewModel() {
val isRecording = MutableLiveData<Boolean>()
val isRemotelyRecorded = MutableLiveData<Boolean>()
val maxParticipantsForMosaicLayout = corePreferences.maxConferenceParticipantsForMosaicLayout
val speakingParticipant = MutableLiveData<ConferenceParticipantDeviceData>()
val participantAdminStatusChangedEvent: MutableLiveData<Event<ConferenceParticipantData>> by lazy {
MutableLiveData<Event<ConferenceParticipantData>>()
}
val maxParticipantsForMosaicLayout = corePreferences.maxConferenceParticipantsForMosaicLayout
val firstToJoinEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val speakingParticipant = MutableLiveData<ConferenceParticipantDeviceData>()
val allParticipantsLeftEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private val conferenceListener = object : ConferenceListenerStub() {
override fun onParticipantAdded(conference: Conference, participant: Participant) {
@ -72,6 +80,10 @@ class ConferenceViewModel : ViewModel() {
override fun onParticipantRemoved(conference: Conference, participant: Participant) {
Log.i("[Conference] Participant removed: ${participant.address.asStringUriOnly()}")
updateParticipantsList(conference)
if (conferenceParticipants.value.orEmpty().isEmpty()) {
allParticipantsLeftEvent.value = Event(true)
}
}
override fun onParticipantDeviceAdded(
@ -246,6 +258,10 @@ class ConferenceViewModel : ViewModel() {
isRecording.value = conference.isRecording
updateConferenceLayout(conference)
if (conferenceParticipants.value.orEmpty().isEmpty()) {
firstToJoinEvent.value = Event(true)
}
}
fun configureConference(conference: Conference) {

View file

@ -721,4 +721,6 @@
<string name="conference_low_bandwidth">Faible bande passante détectée, vidéo désactivée</string>
<string name="content_description_toggle_conference_info_details">Afficher/cacher les détails de la conférence</string>
<string name="content_description_conference_participants">Participants de la conférence</string>
<string name="conference_first_to_join">Vous êtes le premier à avoir rejoint la conférence</string>
<string name="conference_last_user">Tous les autres participants ont quitté la conférence</string>
</resources>

View file

@ -290,6 +290,8 @@
<string name="conference_invitation_received_notification">You have been invited to a conference</string>
<string name="conference_invitation">Conference invitation</string>
<string name="conference_low_bandwidth">Low bandwidth detected, disabling video</string>
<string name="conference_first_to_join">You\'re the first to join the conference</string>
<string name="conference_last_user">All other participants have left the conference</string>
<!-- Call -->
<string name="call_incoming_title">Incoming Call</string>