Fix channel updates

This commit is contained in:
Ali 2021-03-13 00:14:36 +04:00
parent 02258369b7
commit 248e8f7f12
2 changed files with 17 additions and 8 deletions

View File

@ -50,7 +50,7 @@ private func activeChannelsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<Peer
}
}
return peerIds
return peerIds.intersection(peerIdsRequiringLocalChatStateFromUpdateGroups(groups))
}
private func associatedMessageIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<MessageId> {
@ -110,13 +110,15 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro
for group in groups {
peerIds.formUnion(peerIdsRequiringLocalChatStateFromUpdates(group.updates))
for chat in group.chats {
/*for chat in group.chats {
if let channel = parseTelegramGroupOrChannel(chat: chat) as? TelegramChannel {
if case .member = channel.participationStatus {
peerIds.insert(channel.id)
if let accessHash = channel.accessHash, case .personal = accessHash {
if case .member = channel.participationStatus {
peerIds.insert(channel.id)
}
}
}
}
}*/
switch group {
case let .ensurePeerHasLocalState(peerId):

View File

@ -828,6 +828,7 @@ public final class GroupCallParticipantsContext {
public var participationStatusChange: ParticipationStatusChange
public var volume: Int32?
public var about: String?
public var isMin: Bool
init(
peerId: PeerId,
@ -839,7 +840,8 @@ public final class GroupCallParticipantsContext {
muteState: Participant.MuteState?,
participationStatusChange: ParticipationStatusChange,
volume: Int32?,
about: String?
about: String?,
isMin: Bool
) {
self.peerId = peerId
self.ssrc = ssrc
@ -851,6 +853,7 @@ public final class GroupCallParticipantsContext {
self.participationStatusChange = participationStatusChange
self.volume = volume
self.about = about
self.isMin = isMin
}
}
@ -1586,6 +1589,7 @@ extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
}
let isRemoved = (flags & (1 << 1)) != 0
let justJoined = (flags & (1 << 4)) != 0
let isMin = (flags & (1 << 8)) != 0
let participationStatusChange: GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate.ParticipationStatusChange
if isRemoved {
@ -1614,7 +1618,8 @@ extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
muteState: muteState,
participationStatusChange: participationStatusChange,
volume: volume,
about: about
about: about,
isMin: isMin
)
}
}
@ -1647,6 +1652,7 @@ extension GroupCallParticipantsContext.Update.StateUpdate {
}
let isRemoved = (flags & (1 << 1)) != 0
let justJoined = (flags & (1 << 4)) != 0
let isMin = (flags & (1 << 8)) != 0
let participationStatusChange: GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate.ParticipationStatusChange
if isRemoved {
@ -1675,7 +1681,8 @@ extension GroupCallParticipantsContext.Update.StateUpdate {
muteState: muteState,
participationStatusChange: participationStatusChange,
volume: volume,
about: about
about: about,
isMin: isMin
))
}
}