Add Speaker label in Participant list

Fix ConferenceWaitingRoomView
This commit is contained in:
Benoit Martins 2023-08-30 15:18:33 +02:00 committed by QuentinArguillere
parent 669736cc20
commit f25211a9f1
5 changed files with 70 additions and 25 deletions

View file

@ -256,19 +256,23 @@ import linphonesw
let confInfo = ConferenceInfo.getSwiftObject(cObject: conferenceInfo)
var imSpeaker = false
var inList = false
confInfo.participantInfos.forEach { participant in
if participant.address != nil && participant.address!.isMe() && (participant.role == .Speaker || participant.role == .Unknown) {
imSpeaker = true
inList = true
} else if participant.address != nil && participant.address!.isMe() && participant.role == .Listener {
inList = true
}
}
if imSpeaker {
if imSpeaker || !inList {
self.noVideoLabel.text = VoipTexts.conference_waiting_room_video_disabled
} else {
self.noVideoLabel.text = "You're listener"
} else {
self.noVideoLabel.text = VoipTexts.conference_you_are_listener
}
ControlsViewModel.shared.imSpeaker = imSpeaker
ControlsViewModel.shared.imSpeaker = imSpeaker || !inList
}
}

View file

@ -80,6 +80,7 @@ import UIKit
@objc static let call_video_update_requested_dialog = NSLocalizedString("Correspondent would like to turn the video on",comment:"")
@objc static let cancel = NSLocalizedString("Cancel",comment:"")
@objc static let chat_room_group_info_admin = NSLocalizedString("Admin",comment:"")
@objc static let chat_room_group_info_speaker = NSLocalizedString("Speaker",comment:"")
@objc static let conference_creation_failed = NSLocalizedString("Failed to create meeting",comment:"")
@objc static let conference_default_title = NSLocalizedString("Remote group call",comment:"")
@objc static let conference_description_title = NSLocalizedString("Description",comment:"")
@ -165,7 +166,9 @@ import UIKit
@objc static let conference_scheduled_title_participant_cell = NSLocalizedString("Participants",comment:"")
@objc static let conference_scheduled_title_speakers_cell = NSLocalizedString("Speakers",comment:"")
@objc static let conference_scheduled_title_guests_cell = NSLocalizedString("Guests",comment:"")
@objc static let conference_you_are_speaker = NSLocalizedString("You're Speaker",comment:"")
@objc static let conference_you_are_speaker = NSLocalizedString("You're a speaker",comment:"")
@objc static let conference_you_are_listener = NSLocalizedString("You're a listener",comment:"")
@objc static let conference_no_speaker = NSLocalizedString("No speaker has joined the meeting yet",comment:"")
@objc static let image_picker_view_alert_action_title = NSLocalizedString("Select the source",comment:"")
@objc static let image_picker_view_alert_action_camera = NSLocalizedString("Camera",comment:"")

View file

@ -27,6 +27,8 @@ class ConferenceParticipantData {
let isAdmin = MutableLiveData<Bool>()
let isMeAdmin = MutableLiveData<Bool>()
let isBroadcast = MutableLiveData<Bool>()
let isSpeaker = MutableLiveData<Bool>()
private var callDelegate : CallDelegateStub?
@ -35,6 +37,17 @@ class ConferenceParticipantData {
self.participant = participant
isAdmin.value = participant.isAdmin
isMeAdmin.value = conference.me?.isAdmin
var isBroadcastTmp = false
conference.call?.callLog?.conferenceInfo?.participantInfos.forEach { participant in
if participant.role == .Listener {
isBroadcastTmp = true
}
}
isBroadcast.value = isBroadcastTmp
isSpeaker.value = participant.role != .Listener
Log.i("[Conference Participant] Participant \(sipUri!) is admin=\(isAdmin.value!)")
}

View file

@ -60,26 +60,13 @@ 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")
let noSpeakerLabel = StyledLabel(VoipTheme.conference_waiting_room_no_video_font, VoipTexts.conference_no_speaker)
var conferenceViewModel: ConferenceViewModel? = nil {
didSet {
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)
@ -220,6 +207,19 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
func reloadData() {
self.grid.reloadData()
self.meGrid.reloadData()
var noSpeaker = true
conferenceViewModel?.conference.value?.participantList.forEach({ participant in
if participant.role == .Speaker {
noSpeaker = false
}
})
if imSpeaker {
noSpeaker = false
}
self.activeSpeakerView.isHidden = noSpeaker
}
init() {

View file

@ -44,6 +44,7 @@ class VoipParticipantCell: UITableViewCell {
let isAdminLabel = StyledLabel(VoipTheme.conference_participant_admin_label,VoipTexts.chat_room_group_info_admin)
let isAdminCheck = UIImageView(image: UIImage(named:("check_unselected")))
let removePart = CallControlButton(imageInset:dismiss_icon_inset,buttonTheme: VoipTheme.voip_cancel, onClickAction: {})
let isSpeakerLabel = StyledLabel(VoipTheme.conference_participant_admin_label,VoipTexts.chat_room_group_info_speaker)
let addButton = CallControlButton(buttonTheme:VoipTheme.nav_color_button("add_field_default"))
@ -63,8 +64,10 @@ class VoipParticipantCell: UITableViewCell {
self.setAdminStatus(data: data)
}
self.isAdminView.onClick {
data.conference.setParticipantAdminStatus(participant: data.participant, isAdmin: data.isAdmin.value != true)
self.owningParticpantsListView?.participantsListTableView.reloadData()
if !data.isBroadcast.value! {
data.conference.setParticipantAdminStatus(participant: data.participant, isAdmin: data.isAdmin.value != true)
self.owningParticpantsListView?.participantsListTableView.reloadData()
}
}
self.removePart.onClick {
try?data.conference.removeParticipant(participant: data.participant)
@ -77,10 +80,29 @@ class VoipParticipantCell: UITableViewCell {
func setAdminStatus(data:ConferenceParticipantData) {
let isAdmin = data.isAdmin.value!
let isMeAdmin = data.isMeAdmin.value!
self.removePart.isHidden = !isMeAdmin
self.isAdminView.isUserInteractionEnabled = isMeAdmin
self.isAdminLabel.textColor = !isAdmin ? VoipTheme.primarySubtextLightColor.get() : VoipTheme.primaryTextColor.get()
self.isAdminView.isHidden = !isAdmin && !isMeAdmin // Non admin don't see status of others non admin (they just see admins)
let isBroadcast = data.isBroadcast.value!
let isSpeaker = data.isSpeaker.value!
let isExistingConf = data.conference.call?.callLog?.conferenceInfo
if isExistingConf != nil {
addButton.isHidden = true
if isBroadcast {
self.removePart.isHidden = !isMeAdmin
self.isAdminView.isUserInteractionEnabled = isMeAdmin
self.isAdminLabel.isHidden = true
self.isSpeakerLabel.isHidden = !isSpeaker
self.isAdminCheck.isHidden = !isSpeaker
self.isAdminView.isHidden = false
} else {
self.removePart.isHidden = !isMeAdmin
self.isAdminView.isUserInteractionEnabled = isMeAdmin
self.isAdminLabel.isHidden = false
self.isSpeakerLabel.isHidden = true
self.isAdminLabel.textColor = !isAdmin ? VoipTheme.primarySubtextLightColor.get() : VoipTheme.primaryTextColor.get()
self.isAdminView.isHidden = !isAdmin && !isMeAdmin // Non admin don't see status of others non admin (they just see admins)
}
} else {
addButton.isHidden = false
}
}
var scheduleConfParticipantAddress: Address? = nil {
@ -126,6 +148,9 @@ class VoipParticipantCell: UITableViewCell {
isAdminView.addArrangedSubview(isAdminLabel)
isAdminLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
isAdminView.addArrangedSubview(isSpeakerLabel)
isSpeakerLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
isAdminView.addArrangedSubview(removePart)
removePart.setContentHuggingPriority(.defaultHigh, for: .horizontal)