Fix threading issues

This commit is contained in:
Ali 2020-12-01 19:22:47 +04:00
parent 470ea8f692
commit ba3cc3ef06
3 changed files with 4 additions and 43 deletions

View File

@ -618,12 +618,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
)
self.participantsContext = participantsContext
self.participantsContextStateDisposable.set(combineLatest(queue: .mainQueue(),
participantsContext.state |> beforeNext { state in
print("before received members")
for member in state.participants {
print(" \(member.peer.debugDisplayTitle) \(member.activityTimestamp ?? 0.0)")
}
},
participantsContext.state,
participantsContext.numberOfActiveSpeakers |> deliverOnMainQueue,
self.speakingParticipantsContext.get() |> deliverOnMainQueue
).start(next: { [weak self] state, numberOfActiveSpeakers, speakingParticipants in
@ -649,7 +644,9 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
}
if !reportSpeakingParticipants.isEmpty {
strongSelf.participantsContext?.reportSpeakingParticipants(ids: reportSpeakingParticipants)
Queue.mainQueue().justDispatch {
self?.participantsContext?.reportSpeakingParticipants(ids: reportSpeakingParticipants)
}
}
var members = PresentationGroupCallMembers(
@ -681,15 +678,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
members.totalCount = state.totalCount
members.loadMoreToken = state.nextParticipantsFetchOffset
print("received members")
for member in members.participants {
print(" \(member.peer.debugDisplayTitle) \(member.activityTimestamp ?? 0.0)")
}
print("received state members")
for member in state.participants {
print(" \(member.peer.debugDisplayTitle) \(member.activityTimestamp ?? 0.0)")
}
strongSelf.membersValue = members
strongSelf.stateValue.adminIds = state.adminIds

View File

@ -495,11 +495,6 @@ public final class VoiceChatController: ViewController {
return
}
if let groupMembers = strongSelf.currentGroupMembers {
print("update UI members")
for member in callMembers.participants {
print(" \(member.peer.debugDisplayTitle) \(member.activityTimestamp ?? 0.0)")
}
strongSelf.updateMembers(muteState: strongSelf.effectiveMuteState, groupMembers: groupMembers, callMembers: callMembers.participants, speakingPeers: callMembers.speakingParticipants, invitedPeers: strongSelf.currentInvitedPeers ?? Set())
} else {
strongSelf.currentCallMembers = callMembers.participants
@ -1267,8 +1262,6 @@ public final class VoiceChatController: ViewController {
}
processedPeerIds.insert(member.peer.id)
print(" \(member.peer.debugDisplayTitle) \(member.activityTimestamp ?? 0.0)")
let memberState: PeerEntry.State
var memberMuteState: GroupCallParticipantsContext.Participant.MuteState?
if member.peer.id == self.context.account.peerId {

View File

@ -611,13 +611,6 @@ public final class GroupCallParticipantsContext {
private var stateValue: InternalState {
didSet {
if self.stateValue != oldValue {
if self.hasReceivedSpeackingParticipantsReport {
print("set stateValue")
for participant in self.stateValue.state.participants {
print(" \(participant.peer.debugDisplayTitle) \(participant.activityTimestamp ?? 0)")
}
}
self.statePromise.set(self.stateValue)
}
}
@ -799,8 +792,6 @@ public final class GroupCallParticipantsContext {
if updateTimestamp {
updatedParticipants[index].activityTimestamp = timestamp
updated = true
print("update \(updatedParticipants[index].peer.debugDisplayTitle) to \(timestamp)")
}
}
}
@ -816,10 +807,6 @@ public final class GroupCallParticipantsContext {
}
}
for participant in updatedParticipants {
print(" \(participant.peer.debugDisplayTitle) \(participant.activityTimestamp ?? 0)")
}
strongSelf.stateValue = InternalState(
state: State(
participants: updatedParticipants,
@ -950,13 +937,6 @@ public final class GroupCallParticipantsContext {
}
}
if strongSelf.hasReceivedSpeackingParticipantsReport {
print("processUpdate participants")
for participant in updatedParticipants {
print(" \(participant.peer.debugDisplayTitle) \(participant.activityTimestamp ?? 0)")
}
}
strongSelf.stateValue = InternalState(
state: State(
participants: updatedParticipants,