Show voice chat participants count in subtitle

This commit is contained in:
Ilya Laktyushin 2020-11-28 02:16:13 +04:00
parent 2c4cb11524
commit 56a710b729
2 changed files with 12 additions and 17 deletions

View File

@ -73,7 +73,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
private class SpeakingParticipantsContext {
private let speakingLevelThreshold: Float = 0.15
private let cutoffTimeout: Int32 = 1
private let silentTimeout: Int32 = 2
private let silentTimeout: Int32 = 3
struct Participant {
let timestamp: Int32

View File

@ -481,10 +481,16 @@ public final class VoiceChatController: ViewController {
return
}
if let groupMembers = strongSelf.currentGroupMembers {
strongSelf.updateMembers(muteState: strongSelf.callState?.muteState, groupMembers: groupMembers, callMembers: callMembers.participants, speakingPeers: callMembers.speakingParticipants ?? Set(), invitedPeers: strongSelf.currentInvitedPeers ?? Set())
strongSelf.updateMembers(muteState: strongSelf.callState?.muteState, groupMembers: groupMembers, callMembers: callMembers.participants, speakingPeers: callMembers.speakingParticipants, invitedPeers: strongSelf.currentInvitedPeers ?? Set())
} else {
strongSelf.currentCallMembers = callMembers.participants
}
//TODO:localize
let subtitle = strongSelf.presentationData.strings.Conversation_StatusMembers(Int32(callMembers.totalCount))
if let titleView = strongSelf.controller?.navigationItem.titleView as? VoiceChatControllerTitleView {
titleView.set(title: "Voice Chat", subtitle: subtitle)
}
})
self.invitedPeersDisposable = (self.call.invitedPeers
@ -516,21 +522,6 @@ public final class VoiceChatController: ViewController {
return
}
guard let peer = view.peers[view.peerId] else {
return
}
//TODO:localize
var subtitle = "group"
if let cachedData = view.cachedData as? CachedChannelData {
if let memberCount = cachedData.participantsSummary.memberCount {
subtitle = strongSelf.presentationData.strings.Conversation_StatusMembers(memberCount)
}
}
let titleView = VoiceChatControllerTitleView(theme: strongSelf.presentationData.theme)
titleView.set(title: "Voice Chat", subtitle: subtitle)
strongSelf.controller?.navigationItem.titleView = titleView
if !strongSelf.didSetDataReady {
strongSelf.didSetDataReady = true
strongSelf.controller?.dataReady.set(true)
@ -674,6 +665,10 @@ public final class VoiceChatController: ViewController {
override func didLoad() {
super.didLoad()
let titleView = VoiceChatControllerTitleView(theme: self.presentationData.theme)
titleView.set(title: "Voice Chat", subtitle: "connecting")
self.controller?.navigationItem.titleView = titleView
let longTapRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.actionButtonPressGesture(_:)))
longTapRecognizer.minimumPressDuration = 0.001
self.actionButton.view.addGestureRecognizer(longTapRecognizer)