Fix ConferenceCallView when the user is a listener

This commit is contained in:
Benoit Martins 2023-08-29 17:00:45 +02:00 committed by QuentinArguillere
parent 03aec21ded
commit 669736cc20
6 changed files with 48 additions and 26 deletions

View file

@ -257,7 +257,7 @@ import linphonesw
var imSpeaker = false
confInfo.participantInfos.forEach { participant in
if participant.address != nil && participant.address!.isMe() && participant.role == .Speaker {
if participant.address != nil && participant.address!.isMe() && (participant.role == .Speaker || participant.role == .Unknown) {
imSpeaker = true
}
}
@ -265,8 +265,8 @@ import linphonesw
if imSpeaker {
self.noVideoLabel.text = VoipTexts.conference_waiting_room_video_disabled
} else {
self.noVideoLabel.text = "You're listener"
}
self.noVideoLabel.text = "You're listener"
}
ControlsViewModel.shared.imSpeaker = imSpeaker
}

View file

@ -149,8 +149,8 @@ import EventKitUI
join.onClick {
let view : ConferenceWaitingRoomView = self.VIEW(ConferenceWaitingRoomView.compositeViewDescription())
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
view.setDetails(subject: (self.conferenceData?.subject.value)!, url: (self.conferenceData?.address.value)!, conferenceInfo: (self.conferenceData?.conferenceInfo.getCobject)!)
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
}
share.onClick {

View file

@ -229,8 +229,8 @@ class ScheduledConferencesCell: UITableViewCell {
joinConf.width(150).done()
joinConf.onClick {
let view : ConferenceWaitingRoomView = self.VIEW(ConferenceWaitingRoomView.compositeViewDescription())
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
view.setDetails(subject: (self.conferenceData?.subject.value)!, url: (self.conferenceData?.address.value)!, conferenceInfo: (self.conferenceData?.conferenceInfo.getCobject)!)
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
}
joinEditDelete.addArrangedSubview(editConf)

View file

@ -48,6 +48,7 @@ class ConferenceViewModel {
let maxParticipantsForMosaicLayout = ConfigManager.instance().lpConfigIntForKey(key: "max_conf_part_mosaic_layout",defaultValue: 6)
let moreThanTwoParticipants = MutableLiveData<Bool>()
let noSpeaker = MutableLiveData<Bool>()
let speakingParticipant = MutableLiveData<ConferenceParticipantDeviceData>()
@ -56,7 +57,6 @@ class ConferenceViewModel {
let participantAdminStatusChangedEvent = MutableLiveData<ConferenceParticipantData>()
let firstToJoinEvent = MutableLiveData(false)
let participantAdded = MutableLiveData(false)
let allParticipantsLeftEvent = MutableLiveData(false)
@ -69,7 +69,6 @@ class ConferenceViewModel {
conferenceDelegate = ConferenceDelegateStub(
onParticipantAdded: { (conference: Conference, participant: Participant) in
Log.i("[Conference] \(conference) Participant \(participant) added")
self.participantAdded.value = true
self.updateParticipantsList(conference)
},
onParticipantRemoved: {(conference: Conference, participant: Participant) in
@ -78,6 +77,18 @@ class ConferenceViewModel {
if (self.conferenceParticipants.value?.count == 0) {
self.allParticipantsLeftEvent.value = true
}
var noSpeaker = true
conference.participantList.forEach { participant in
if participant.role == .Speaker {
noSpeaker = false
}
}
if conference.me?.role == .Speaker {
noSpeaker = false
}
if noSpeaker {
self.noSpeaker.value = noSpeaker
}
},
onParticipantDeviceAdded: {(conference: Conference, participantDevice: ParticipantDevice) in
Log.i("[Conference] \(conference) Participant device \(participantDevice) added")
@ -87,6 +98,10 @@ class ConferenceViewModel {
Log.i("[Conference] \(conference) Participant device \(participantDevice) removed")
self.removeParticipantDevice(device: participantDevice)
},
onParticipantRoleChanged: { (conference: Conference, participant: Participant) in
Log.i("[Conference] \(conference) Participant \(participant) added")
self.updateParticipantsList(conference)
},
onParticipantAdminStatusChanged: { (conference: Conference, participant: Participant) in
Log.i("[Conference] \(conference) Participant admin status changed")
self.isMeAdmin.value = conference.me?.isAdmin

View file

@ -30,7 +30,6 @@ import linphonesw
var conferenceAudioOnlyView: VoipConferenceAudioOnlyView? = nil
let conferenceJoinSpinner = RotatingSpinner(color:VoipTheme.dark_grey_color)
@objc var participantsListView : ParticipantsListView? = nil
let noSpeaker = StyledLabel(VoipTheme.conference_waiting_room_no_video_font, "No speaker has joined the meeting yet")
static let compositeDescription = UICompositeViewDescription(ConferenceCallView.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: nil, fullscreen: false, isLeftFragment: false,fragmentWith: nil)
static func compositeViewDescription() -> UICompositeViewDescription! { return compositeDescription }
@ -46,13 +45,6 @@ import linphonesw
view.addSubview(conferencePausedView!)
conferencePausedView?.matchParentSideBorders().matchParentHeight().alignAbove(view:controlsView,withMargin:SharedLayoutConstants.buttons_bottom_margin).done()
conferencePausedView?.isHidden = true
view.addSubview(noSpeaker)
noSpeaker.matchParentSideBorders(insetedByDx: 30).height(250).centerY().done()
noSpeaker.backgroundColor = VoipTheme.voipParticipantBackgroundColor.get()
noSpeaker.isHidden = true
// Conference grid
conferenceGridView = VoipConferenceGridView()
@ -128,19 +120,14 @@ import linphonesw
ConferenceViewModel.shared.allParticipantsLeftEvent.observe { (allLeft) in
if (allLeft == true) {
VoipDialog.toast(message: VoipTexts.conference_last_user)
self.conferenceActiveSpeakerView?.grid.isHidden = true
}
}
ConferenceViewModel.shared.firstToJoinEvent.observe { (first) in
if (first == true) {
VoipDialog.toast(message: VoipTexts.conference_first_to_join)
if !ControlsViewModel.shared.imSpeaker {
self.noSpeaker.isHidden = false
}
}
}
ConferenceViewModel.shared.participantAdded.observe { (participant) in
self.noSpeaker.isHidden = true
}
view.onClick {
ControlsViewModel.shared.audioRoutesSelected.value = false

View file

@ -60,10 +60,26 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
var imSpeaker = true
let noSpeakerLabel = StyledLabel(VoipTheme.conference_waiting_room_no_video_font, "No speaker has joined the meeting yet")
var conferenceViewModel: ConferenceViewModel? = nil {
didSet {
imSpeaker = conferenceViewModel?.conference.value?.me?.role == .Speaker
if let model = conferenceViewModel {
imSpeaker = conferenceViewModel?.conference.value?.me?.role == .Speaker
var noSpeaker = true
conferenceViewModel?.conference.value?.participantList.forEach({ participant in
if participant.role == .Speaker {
noSpeaker = false
}
})
if imSpeaker {
noSpeaker = false
}
self.activeSpeakerView.isHidden = noSpeaker
self.activeSpeakerVideoView.isHidden = true
self.activeSpeakerVideoViewAlone.isHidden = true
self.setJoininngSpeakerState(enabled: false)
@ -158,6 +174,11 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
}
}
}
model.noSpeaker.readCurrentAndObserve { noSpeaker in
if noSpeaker != nil {
self.activeSpeakerView.isHidden = noSpeaker!
}
}
}
self.reloadData()
@ -273,7 +294,6 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
headerView.addArrangedSubview(remotelyRecording)
remotelyRecording.matchParentSideBorders().alignUnder(view:upperSection, withMargin:ActiveCallView.remote_recording_margin_top).height(CGFloat(ActiveCallView.remote_recording_height)).done()
// Container view that can toggle full screen by single tap
let fullScreenMutableView = UIView()
addSubview(fullScreenMutableView)
@ -281,6 +301,9 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
fullScreenMutableView.matchParentSideBorders().alignUnder(view:headerView,withMargin: ActiveCallView.center_view_margin_top).alignParentBottom().done()
fullScreenOpaqueMasqForNotchedDevices.backgroundColor = fullScreenMutableView.backgroundColor
fullScreenMutableView.addSubview(noSpeakerLabel)
noSpeakerLabel.matchParentSideBorders().centerY().done()
// Active speaker
fullScreenMutableView.addSubview(activeSpeakerView)
activeSpeakerView.layer.cornerRadius = ActiveCallView.center_view_corner_radius
@ -481,7 +504,4 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}