forked from mirrors/linphone-iphone
Change UI when user isn't a speaker in callview
This commit is contained in:
parent
2c47087a80
commit
03aec21ded
5 changed files with 49 additions and 11 deletions
|
|
@ -39,7 +39,7 @@ import linphonesw
|
|||
let subject = StyledLabel(VoipTheme.conference_preview_subject_font)
|
||||
let localVideo = UIView()
|
||||
let switchCamera = UIImageView(image: UIImage(named:"voip_change_camera")?.tinted(with:.white))
|
||||
let noVideoLabel = StyledLabel(VoipTheme.conference_waiting_room_no_video_font, VoipTexts.conference_waiting_room_video_disabled)
|
||||
let noVideoLabel = StyledLabel(VoipTheme.conference_waiting_room_no_video_font)
|
||||
|
||||
let buttonsView = UIStackView()
|
||||
let cancel = FormButton(title: VoipTexts.cancel.uppercased(), backgroundStateColors: VoipTheme.primary_colors_background_gray, bold:false)
|
||||
|
|
@ -48,7 +48,6 @@ import linphonesw
|
|||
|
||||
var conferenceUrl : String? = nil
|
||||
let conferenceSubject = MutableLiveData<String>()
|
||||
var conferenceSpeaker : Bool? = false
|
||||
|
||||
let controlsView = ControlsView(showVideo: true, controlsViewModel: ConferenceWaitingRoomViewModel.sharedModel)
|
||||
var layoutPicker : CallControlButton? = nil
|
||||
|
|
@ -262,8 +261,14 @@ import linphonesw
|
|||
imSpeaker = true
|
||||
}
|
||||
}
|
||||
|
||||
self.conferenceSpeaker = imSpeaker
|
||||
|
||||
if imSpeaker {
|
||||
self.noVideoLabel.text = VoipTexts.conference_waiting_room_video_disabled
|
||||
} else {
|
||||
self.noVideoLabel.text = "You're listener"
|
||||
}
|
||||
|
||||
ControlsViewModel.shared.imSpeaker = imSpeaker
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class ConferenceViewModel {
|
|||
let participantAdminStatusChangedEvent = MutableLiveData<ConferenceParticipantData>()
|
||||
|
||||
let firstToJoinEvent = MutableLiveData(false)
|
||||
let participantAdded = MutableLiveData(false)
|
||||
|
||||
let allParticipantsLeftEvent = MutableLiveData(false)
|
||||
|
||||
|
|
@ -68,6 +69,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ class ControlsViewModel {
|
|||
static let shared = ControlsViewModel()
|
||||
private var coreDelegate : CoreDelegateStub?
|
||||
private var previousCallState = Call.State.Idle
|
||||
|
||||
|
||||
var imSpeaker : Bool = true
|
||||
|
||||
init () {
|
||||
coreDelegate = CoreDelegateStub(
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ 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 }
|
||||
|
|
@ -45,6 +46,13 @@ 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()
|
||||
|
|
@ -125,8 +133,14 @@ import linphonesw
|
|||
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
|
||||
|
|
|
|||
|
|
@ -39,10 +39,14 @@ class ControlsView: UIStackView {
|
|||
})
|
||||
addArrangedSubview(mute)
|
||||
controlsViewModel.isMicrophoneMuted.readCurrentAndObserve { (muted) in
|
||||
mute.isSelected = muted == true
|
||||
mute.isSelected = muted == true
|
||||
}
|
||||
controlsViewModel.isMuteMicrophoneEnabled.readCurrentAndObserve { (enabled) in
|
||||
mute.isEnabled = enabled == true
|
||||
if ControlsViewModel.shared.imSpeaker {
|
||||
mute.isEnabled = enabled == true
|
||||
} else {
|
||||
mute.isEnabled = false
|
||||
}
|
||||
}
|
||||
mute.accessibilityIdentifier = "call_control_view_mute"
|
||||
mute.accessibilityLabel = "Mute"
|
||||
|
|
@ -95,13 +99,25 @@ class ControlsView: UIStackView {
|
|||
addArrangedSubview(video)
|
||||
video.showActivityIndicatorDataSource = controlsViewModel.isVideoUpdateInProgress
|
||||
controlsViewModel.isVideoEnabled.readCurrentAndObserve { (selected) in
|
||||
video.isSelected = selected == true
|
||||
if ControlsViewModel.shared.imSpeaker {
|
||||
video.isSelected = selected == true
|
||||
} else {
|
||||
video.isSelected = false
|
||||
}
|
||||
}
|
||||
controlsViewModel.isVideoAvailable.readCurrentAndObserve { (available) in
|
||||
video.isEnabled = available == true && controlsViewModel.isVideoUpdateInProgress.value != true
|
||||
if ControlsViewModel.shared.imSpeaker {
|
||||
video.isEnabled = available == true && controlsViewModel.isVideoUpdateInProgress.value != true
|
||||
} else {
|
||||
video.isEnabled = false
|
||||
}
|
||||
}
|
||||
controlsViewModel.isVideoUpdateInProgress.readCurrentAndObserve { (updateInProgress) in
|
||||
video.isEnabled = updateInProgress != true && controlsViewModel.isVideoAvailable.value == true
|
||||
if ControlsViewModel.shared.imSpeaker {
|
||||
video.isEnabled = updateInProgress != true && controlsViewModel.isVideoAvailable.value == true
|
||||
} else {
|
||||
video.isEnabled = false
|
||||
}
|
||||
}
|
||||
video.accessibilityIdentifier = "call_control_view_video"
|
||||
video.accessibilityLabel = "Video"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue