Video Chats Improvements

This commit is contained in:
Ilya Laktyushin
2021-04-21 03:07:13 +03:00
parent d9f3dba292
commit 6cbe2f8f35
10 changed files with 840 additions and 260 deletions

View File

@@ -1905,7 +1905,9 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|> mapToSignal { event -> Signal<PresentationGroupCallMemberEvent, NoError> in
return postbox.transaction { transaction -> Signal<PresentationGroupCallMemberEvent, NoError> in
if let peer = transaction.getPeer(event.peerId) {
return .single(PresentationGroupCallMemberEvent(peer: peer, joined: event.joined))
let isContact = transaction.isPeerContact(peerId: event.peerId)
let isInChatList = transaction.getPeerChatListIndex(event.peerId) != nil
return .single(PresentationGroupCallMemberEvent(peer: peer, isContact: isContact, isInChatList: isInChatList, canUnmute: event.canUnmute, joined: event.joined))
} else {
return .complete()
}
@@ -1913,13 +1915,20 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|> switchToLatest
}
|> deliverOnMainQueue).start(next: { [weak self] event in
guard let strongSelf = self else {
guard let strongSelf = self, event.peer.id != strongSelf.stateValue.myPeerId else {
return
}
if event.peer.id == strongSelf.stateValue.myPeerId {
return
var skip = false
if let participantsCount = strongSelf.participantsContext?.immediateState?.totalCount, participantsCount >= 250 {
if event.peer.isVerified || event.isContact || event.isInChatList || (strongSelf.stateValue.defaultParticipantMuteState == .muted && event.canUnmute) {
skip = false
} else {
skip = true
}
}
if !skip {
strongSelf.memberEventsPipe.putNext(event)
}
strongSelf.memberEventsPipe.putNext(event)
}))
if let isCurrentlyConnecting = self.isCurrentlyConnecting, isCurrentlyConnecting {