From 3bd7a7f19c2dcb79b144aafb29ec6adbee3d525b Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 31 Aug 2023 10:23:31 +0200 Subject: [PATCH] Display the "user is now admin" popup in the participant list only --- .../Swift/Voip/ViewModels/ConferenceViewModel.swift | 4 +++- .../CompositeViewControllers/ConferenceCallView.swift | 10 ++++++---- .../Swift/Voip/Views/Fragments/DismissableView.swift | 3 +-- .../Voip/Views/Fragments/VoipExtraButtonsView.swift | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Classes/Swift/Voip/ViewModels/ConferenceViewModel.swift b/Classes/Swift/Voip/ViewModels/ConferenceViewModel.swift index 6961bd16f..ed6c9ce1f 100644 --- a/Classes/Swift/Voip/ViewModels/ConferenceViewModel.swift +++ b/Classes/Swift/Voip/ViewModels/ConferenceViewModel.swift @@ -108,7 +108,9 @@ class ConferenceViewModel { self.updateParticipantsList(conference) if let participantData = self.conferenceParticipants.value?.filter ({$0.participant.address!.weakEqual(address2: participant.address!)}).first { self.participantAdminStatusChangedEvent.value = participantData - self.notifyAdminStatusChanged(participantData: participantData) + if(ControlsViewModel.shared.goToConferenceParticipantsListEvent.value!){ + self.notifyAdminStatusChanged(participantData: participantData) + } } else { Log.w("[Conference] Failed to find participant [\(participant.address!.asStringUriOnly())] in conferenceParticipants list") } diff --git a/Classes/Swift/Voip/Views/CompositeViewControllers/ConferenceCallView.swift b/Classes/Swift/Voip/Views/CompositeViewControllers/ConferenceCallView.swift index 1eccac699..8597e88ee 100644 --- a/Classes/Swift/Voip/Views/CompositeViewControllers/ConferenceCallView.swift +++ b/Classes/Swift/Voip/Views/CompositeViewControllers/ConferenceCallView.swift @@ -103,10 +103,12 @@ import linphonesw } // Conference Participants List - ControlsViewModel.shared.goToConferenceParticipantsListEvent.observe { (_) in - self.participantsListView = ParticipantsListView() - self.view.addSubview(self.participantsListView!) - self.participantsListView?.matchParentDimmensions().done() + ControlsViewModel.shared.goToConferenceParticipantsListEvent.observe { goToConferenceParticipantsList in + if goToConferenceParticipantsList! { + self.participantsListView = ParticipantsListView() + self.view.addSubview(self.participantsListView!) + self.participantsListView?.matchParentDimmensions().done() + } } // Conference mode selection diff --git a/Classes/Swift/Voip/Views/Fragments/DismissableView.swift b/Classes/Swift/Voip/Views/Fragments/DismissableView.swift index d71e2aa75..1ff01ea95 100644 --- a/Classes/Swift/Voip/Views/Fragments/DismissableView.swift +++ b/Classes/Swift/Voip/Views/Fragments/DismissableView.swift @@ -41,6 +41,7 @@ class DismissableView: UIView { dismiss = CallControlButton(imageInset:dismiss_icon_inset,buttonTheme: VoipTheme.voip_cancel, onClickAction: { self.removeFromSuperview() + ControlsViewModel.shared.goToConferenceParticipantsListEvent.value = false }) headerView.addSubview(dismiss!) dismiss?.alignParentRight(withMargin: dismiss_right_margin).centerY().done() @@ -56,11 +57,9 @@ class DismissableView: UIView { UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in self.headerView.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get() } - } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } - } diff --git a/Classes/Swift/Voip/Views/Fragments/VoipExtraButtonsView.swift b/Classes/Swift/Voip/Views/Fragments/VoipExtraButtonsView.swift index 4696182c5..3db0ae930 100644 --- a/Classes/Swift/Voip/Views/Fragments/VoipExtraButtonsView.swift +++ b/Classes/Swift/Voip/Views/Fragments/VoipExtraButtonsView.swift @@ -102,7 +102,7 @@ class VoipExtraButtonsView: UIStackView { transfer.accessibilityIdentifier = "active_call_extra_buttons_transfer" let participants = VoipExtraButton(text: VoipTexts.call_action_participants_list, buttonTheme: VoipTheme.call_action("voip_call_participants"),onClickAction: { - ControlsViewModel.shared.goToConferenceParticipantsListEvent.notifyAllObservers(with: true) + ControlsViewModel.shared.goToConferenceParticipantsListEvent.value = true }) row2.addArrangedSubview(participants) participants.accessibilityIdentifier = "active_call_extra_buttons_participants"