forked from mirrors/linphone-iphone
Fix layout change when reaching more than 6 participants
This commit is contained in:
parent
988840d9a9
commit
82704471ac
2 changed files with 13 additions and 9 deletions
|
|
@ -68,12 +68,6 @@ class ConferenceViewModel {
|
|||
onParticipantAdded: { (conference: Conference, participant: Participant) in
|
||||
Log.i("[Conference] \(conference) Participant \(participant) added")
|
||||
self.updateParticipantsList(conference)
|
||||
let count = self.conferenceParticipantDevices.value!.count
|
||||
if (count > self.maxParticipantsForMosaicLayout && conference.currentParams?.videoEnabled == true && conference.call?.currentParams?.conferenceVideoLayout == .Grid) {
|
||||
Log.w("[Conference] \(conference) More than \(self.maxParticipantsForMosaicLayout) participants \(count), forcing active speaker layout from Grid")
|
||||
self.conferenceDisplayMode.value = .ActiveSpeaker
|
||||
self.changeLayout(layout: .ActiveSpeaker)
|
||||
}
|
||||
},
|
||||
onParticipantRemoved: {(conference: Conference, participant: Participant) in
|
||||
Log.i("[Conference] \(conference) \(participant) Participant removed")
|
||||
|
|
|
|||
|
|
@ -53,8 +53,15 @@ class VoipConferenceGridView: UIView, UICollectionViewDataSource, UICollectionVi
|
|||
duration.conference = model.conference.value
|
||||
self.remotelyRecording.isRemotelyRecorded = model.isRemotelyRecorded
|
||||
model.conferenceParticipantDevices.clearObservers()
|
||||
model.conferenceParticipantDevices.readCurrentAndObserve { (_) in
|
||||
self.reloadData()
|
||||
model.conferenceParticipantDevices.readCurrentAndObserve { (devices) in
|
||||
if (devices!.count > model.maxParticipantsForMosaicLayout && model.conference.value?.currentParams?.videoEnabled == true && model.conferenceDisplayMode.value == .Grid) {
|
||||
Log.w("[Conference] \(model.conference) More than \(model.maxParticipantsForMosaicLayout) participants \(devices!.count), forcing active speaker layout from Grid")
|
||||
model.conferenceDisplayMode.value = .ActiveSpeaker
|
||||
model.changeLayout(layout: .ActiveSpeaker)
|
||||
VoipDialog.toast(message: VoipTexts.conference_too_many_participants_for_mosaic_layout)
|
||||
} else {
|
||||
self.reloadData()
|
||||
}
|
||||
}
|
||||
model.isConferenceLocallyPaused.clearObservers()
|
||||
model.isConferenceLocallyPaused.readCurrentAndObserve { (paused) in
|
||||
|
|
@ -183,7 +190,10 @@ class VoipConferenceGridView: UIView, UICollectionViewDataSource, UICollectionVi
|
|||
func reloadData() {
|
||||
conferenceViewModel?.conferenceParticipantDevices.value?.forEach {
|
||||
$0.clearObservers()
|
||||
}
|
||||
}
|
||||
if let participantCount = conferenceViewModel?.conferenceParticipantDevices.value!.count, participantCount > conferenceViewModel!.maxParticipantsForMosaicLayout {
|
||||
return
|
||||
}
|
||||
if (self.isHidden) {
|
||||
self.grid.reloadData()
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue