Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2021-03-13 03:14:43 +04:00
commit ab8ef13188
4 changed files with 24 additions and 14 deletions

View File

@ -1082,11 +1082,12 @@ public final class VoiceChatController: ViewController {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
let callPeerId = strongSelf.call.peerId
let _ = (strongSelf.context.account.postbox.transaction { transaction -> String? in let _ = (strongSelf.context.account.postbox.transaction { transaction -> String? in
if let peer = transaction.getPeer(call.peerId), let addressName = peer.addressName, !addressName.isEmpty { if let peer = transaction.getPeer(callPeerId), let addressName = peer.addressName, !addressName.isEmpty {
return "https://t.me/\(addressName)" return "https://t.me/\(addressName)"
} else if let cachedData = transaction.getPeerCachedData(peerId: call.peerId) { } else if let cachedData = transaction.getPeerCachedData(peerId: callPeerId) {
if let cachedData = cachedData as? CachedChannelData { if let cachedData = cachedData as? CachedChannelData {
return cachedData.exportedInvitation?.link return cachedData.exportedInvitation?.link
} else if let cachedData = cachedData as? CachedGroupData { } else if let cachedData = cachedData as? CachedGroupData {
@ -1459,7 +1460,7 @@ public final class VoiceChatController: ViewController {
} }
}) })
self.audioOutputStateDisposable = (call.audioOutputState self.audioOutputStateDisposable = (self.call.audioOutputState
|> deliverOnMainQueue).start(next: { [weak self] state in |> deliverOnMainQueue).start(next: { [weak self] state in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
@ -1474,7 +1475,7 @@ public final class VoiceChatController: ViewController {
} }
}) })
self.audioLevelsDisposable = (call.audioLevels self.audioLevelsDisposable = (self.call.audioLevels
|> deliverOnMainQueue).start(next: { [weak self] levels in |> deliverOnMainQueue).start(next: { [weak self] levels in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
@ -1508,7 +1509,7 @@ public final class VoiceChatController: ViewController {
strongSelf.itemInteraction?.updateAudioLevels(levels) strongSelf.itemInteraction?.updateAudioLevels(levels)
}) })
self.myAudioLevelDisposable = (call.myAudioLevel self.myAudioLevelDisposable = (self.call.myAudioLevel
|> deliverOnMainQueue).start(next: { [weak self] level in |> deliverOnMainQueue).start(next: { [weak self] level in
guard let strongSelf = self else { guard let strongSelf = self else {
return return

View File

@ -726,7 +726,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode {
raiseHandNode.playRandomAnimation() raiseHandNode.playRandomAnimation()
strongSelf.raiseHandTimer = SwiftSignalKit.Timer(timeout: Double.random(in: 8.0 ... 10.5), repeat: true, completion: { strongSelf.raiseHandTimer = SwiftSignalKit.Timer(timeout: Double.random(in: 8.0 ... 10.5), repeat: true, completion: {
strongSelf.raiseHandNode?.playRandomAnimation() self?.raiseHandNode?.playRandomAnimation()
}, queue: Queue.mainQueue()) }, queue: Queue.mainQueue())
strongSelf.raiseHandTimer?.start() strongSelf.raiseHandTimer?.start()
} }

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

View File

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