From 4e412660733d4d46c95ff137adafa7b0b19edec2 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 7 Mar 2021 09:31:07 +0400 Subject: [PATCH] Add raised hand voice chat participant status --- .../Sources/VoiceChatController.swift | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index 50423bb6b1..3f8a297c85 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -370,6 +370,7 @@ public final class VoiceChatController: ViewController { case listening case speaking case invited + case raisedHand } var peer: Peer @@ -383,7 +384,6 @@ public final class VoiceChatController: ViewController { var revealed: Bool? var canManageCall: Bool var volume: Int32? - var raiseHandStatus: Bool var stableId: PeerId { return self.peer.id @@ -423,9 +423,6 @@ public final class VoiceChatController: ViewController { if lhs.volume != rhs.volume { return false } - if lhs.raiseHandStatus != rhs.raiseHandStatus { - return false - } return true } @@ -523,12 +520,10 @@ public final class VoiceChatController: ViewController { let icon: VoiceChatParticipantItem.Icon switch peerEntry.state { case .listening: - var isAbout = false if let muteState = peerEntry.muteState, muteState.mutedByYou { text = .text(presentationData.strings.VoiceChat_StatusMutedForYou, .destructive) } else if let about = peerEntry.about, !about.isEmpty { text = .text(about, .generic) - isAbout = true } else { text = .text(presentationData.strings.VoiceChat_StatusListening, .generic) } @@ -555,12 +550,11 @@ public final class VoiceChatController: ViewController { case .invited: text = .text(presentationData.strings.VoiceChat_StatusInvited, .generic) icon = .invite(true) + case .raisedHand: + text = .text(presentationData.strings.VoiceChat_StatusWantsToSpeak, .accent) + icon = .invite(true) } - - if peerEntry.raiseHandStatus, case let .text(value, type) = text { - text = .text("[hand] \(value)", type) - } - + let revealOptions: [VoiceChatParticipantItem.RevealOption] = [] return VoiceChatParticipantItem(presentationData: ItemListPresentationData(presentationData), dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, context: context, peer: peer, ssrc: peerEntry.ssrc, presence: peerEntry.presence, text: text, icon: icon, enabled: true, selectable: !peerEntry.isMyPeer || peerEntry.canManageCall, getAudioLevel: { return interaction.getAudioLevel(peer.id) }, getVideo: { @@ -2748,7 +2742,10 @@ public final class VoiceChatController: ViewController { let memberState: PeerEntry.State var memberMuteState: GroupCallParticipantsContext.Participant.MuteState? - if member.peer.id == self.callState?.myPeerId { + if member.raiseHandRating != nil { + memberState = .raisedHand + memberMuteState = member.muteState + } else if member.peer.id == self.callState?.myPeerId { if muteState == nil { memberState = speakingPeers.contains(member.peer.id) ? .speaking : .listening } else { @@ -2770,8 +2767,7 @@ public final class VoiceChatController: ViewController { state: memberState, muteState: memberMuteState, canManageCall: self.callState?.canManageCall ?? false, - volume: member.volume, - raiseHandStatus: member.raiseHandRating != nil + volume: member.volume ))) index += 1 } @@ -2792,8 +2788,7 @@ public final class VoiceChatController: ViewController { state: .invited, muteState: nil, canManageCall: false, - volume: nil, - raiseHandStatus: false + volume: nil ))) index += 1 }