mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
ec9908ec2f
@ -426,6 +426,8 @@ final class CallListControllerNode: ASDisplayNode {
|
|||||||
case let .MessageEntry(_, _, _, _, _, renderedPeer, _, _, _, _):
|
case let .MessageEntry(_, _, _, _, _, renderedPeer, _, _, _, _):
|
||||||
if let channel = renderedPeer.peer as? TelegramChannel, channel.flags.contains(.hasActiveVoiceChat) {
|
if let channel = renderedPeer.peer as? TelegramChannel, channel.flags.contains(.hasActiveVoiceChat) {
|
||||||
result.append(channel)
|
result.append(channel)
|
||||||
|
} else if let group = renderedPeer.peer as? TelegramGroup, group.flags.contains(.hasActiveVoiceChat) {
|
||||||
|
result.append(group)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -1267,6 +1267,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
var contentHeight = max(layout.size.height, max(layout.size.height, originalActionsFrame.maxY + actionsBottomInset) - originalContentFrame.minY + contentTopInset)
|
var contentHeight = max(layout.size.height, max(layout.size.height, originalActionsFrame.maxY + actionsBottomInset) - originalContentFrame.minY + contentTopInset)
|
||||||
|
contentHeight = max(contentHeight, actionsSize.height + originalActionsFrame.minY + actionsBottomInset)
|
||||||
|
|
||||||
var overflowOffset: CGFloat
|
var overflowOffset: CGFloat
|
||||||
var contentContainerFrame: CGRect
|
var contentContainerFrame: CGRect
|
||||||
|
@ -1310,9 +1310,11 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
|
|
||||||
|
let myPeerId = self.joinAsPeerId
|
||||||
|
|
||||||
var initialState = initialState
|
var initialState = initialState
|
||||||
if let participantsContext = self.participantsContext, let immediateState = participantsContext.immediateState {
|
if let participantsContext = self.participantsContext, let immediateState = participantsContext.immediateState {
|
||||||
initialState.mergeActivity(from: immediateState)
|
initialState.mergeActivity(from: immediateState, myPeerId: myPeerId, previousMyPeerId: self.ignorePreviousJoinAsPeerId?.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
let participantsContext = GroupCallParticipantsContext(
|
let participantsContext = GroupCallParticipantsContext(
|
||||||
@ -1325,7 +1327,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
)
|
)
|
||||||
self.temporaryParticipantsContext = nil
|
self.temporaryParticipantsContext = nil
|
||||||
self.participantsContext = participantsContext
|
self.participantsContext = participantsContext
|
||||||
let myPeerId = self.joinAsPeerId
|
|
||||||
let myPeer = self.accountContext.account.postbox.transaction { transaction -> (Peer, CachedPeerData?)? in
|
let myPeer = self.accountContext.account.postbox.transaction { transaction -> (Peer, CachedPeerData?)? in
|
||||||
if let peer = transaction.getPeer(myPeerId) {
|
if let peer = transaction.getPeer(myPeerId) {
|
||||||
return (peer, transaction.getPeerCachedData(peerId: myPeerId))
|
return (peer, transaction.getPeerCachedData(peerId: myPeerId))
|
||||||
|
@ -2346,7 +2346,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
self.isFullscreen = isFullscreen
|
self.isFullscreen = isFullscreen
|
||||||
|
|
||||||
self.controller?.statusBar.statusBarStyle = isFullscreen ? .White : .Ignore
|
self.controller?.statusBar.updateStatusBarStyle(isFullscreen ? .White : .Ignore, animated: true)
|
||||||
|
|
||||||
var size = layout.size
|
var size = layout.size
|
||||||
if case .regular = layout.metrics.widthClass {
|
if case .regular = layout.metrics.widthClass {
|
||||||
|
@ -452,7 +452,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal
|
|||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiUsers: [Api.User] = []
|
let apiUsers: [Api.User] = []
|
||||||
|
|
||||||
state.adminIds = Set(peerAdminIds)
|
state.adminIds = Set(peerAdminIds)
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
public var totalCount: Int
|
public var totalCount: Int
|
||||||
public var version: Int32
|
public var version: Int32
|
||||||
|
|
||||||
public mutating func mergeActivity(from other: State) {
|
public mutating func mergeActivity(from other: State, myPeerId: PeerId, previousMyPeerId: PeerId?) {
|
||||||
var indexMap: [PeerId: Int] = [:]
|
var indexMap: [PeerId: Int] = [:]
|
||||||
for i in 0 ..< other.participants.count {
|
for i in 0 ..< other.participants.count {
|
||||||
indexMap[other.participants[i].peer.id] = i
|
indexMap[other.participants[i].peer.id] = i
|
||||||
@ -764,6 +764,9 @@ public final class GroupCallParticipantsContext {
|
|||||||
for i in 0 ..< self.participants.count {
|
for i in 0 ..< self.participants.count {
|
||||||
if let index = indexMap[self.participants[i].peer.id] {
|
if let index = indexMap[self.participants[i].peer.id] {
|
||||||
self.participants[i].mergeActivity(from: other.participants[index])
|
self.participants[i].mergeActivity(from: other.participants[index])
|
||||||
|
if self.participants[i].peer.id == myPeerId || self.participants[i].peer.id == previousMyPeerId {
|
||||||
|
self.participants[i].joinTimestamp = other.participants[index].joinTimestamp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,9 +1295,11 @@ public final class GroupCallParticipantsContext {
|
|||||||
assertionFailure()
|
assertionFailure()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
var previousJoinTimestamp: Int32?
|
||||||
var previousActivityTimestamp: Double?
|
var previousActivityTimestamp: Double?
|
||||||
var previousActivityRank: Int?
|
var previousActivityRank: Int?
|
||||||
if let index = updatedParticipants.firstIndex(where: { $0.peer.id == participantUpdate.peerId }) {
|
if let index = updatedParticipants.firstIndex(where: { $0.peer.id == participantUpdate.peerId }) {
|
||||||
|
previousJoinTimestamp = updatedParticipants[index].joinTimestamp
|
||||||
previousActivityTimestamp = updatedParticipants[index].activityTimestamp
|
previousActivityTimestamp = updatedParticipants[index].activityTimestamp
|
||||||
previousActivityRank = updatedParticipants[index].activityRank
|
previousActivityRank = updatedParticipants[index].activityRank
|
||||||
updatedParticipants.remove(at: index)
|
updatedParticipants.remove(at: index)
|
||||||
@ -1314,7 +1319,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
peer: peer,
|
peer: peer,
|
||||||
ssrc: participantUpdate.ssrc,
|
ssrc: participantUpdate.ssrc,
|
||||||
jsonParams: participantUpdate.jsonParams,
|
jsonParams: participantUpdate.jsonParams,
|
||||||
joinTimestamp: participantUpdate.joinTimestamp,
|
joinTimestamp: previousJoinTimestamp ?? participantUpdate.joinTimestamp,
|
||||||
raiseHandRating: participantUpdate.raiseHandRating,
|
raiseHandRating: participantUpdate.raiseHandRating,
|
||||||
hasRaiseHand: participantUpdate.raiseHandRating != nil,
|
hasRaiseHand: participantUpdate.raiseHandRating != nil,
|
||||||
activityTimestamp: activityTimestamp,
|
activityTimestamp: activityTimestamp,
|
||||||
@ -1777,9 +1782,8 @@ public func groupCallDisplayAsAvailablePeers(network: Network, postbox: Postbox,
|
|||||||
return network.request(Api.functions.phone.getGroupCallJoinAs(peer: inputPeer))
|
return network.request(Api.functions.phone.getGroupCallJoinAs(peer: inputPeer))
|
||||||
|> retryRequest
|
|> retryRequest
|
||||||
|> mapToSignal { result in
|
|> mapToSignal { result in
|
||||||
var peers:[Peer]
|
|
||||||
switch result {
|
switch result {
|
||||||
case let .joinAsPeers(peers, chats, users):
|
case let .joinAsPeers(_, chats, _):
|
||||||
var subscribers: [PeerId: Int32] = [:]
|
var subscribers: [PeerId: Int32] = [:]
|
||||||
let peers = chats.compactMap(parseTelegramGroupOrChannel)
|
let peers = chats.compactMap(parseTelegramGroupOrChannel)
|
||||||
for chat in chats {
|
for chat in chats {
|
||||||
|
@ -258,8 +258,27 @@ final class AuthorizedApplicationContext {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
let postbox = context.account.postbox
|
||||||
self.notificationMessagesDisposable.set((context.account.stateManager.notificationMessages
|
self.notificationMessagesDisposable.set((context.account.stateManager.notificationMessages
|
||||||
|
|> mapToSignal { messageList -> Signal<[([Message], PeerGroupId, Bool)], NoError> in
|
||||||
|
return postbox.transaction { transaction -> [([Message], PeerGroupId, Bool)] in
|
||||||
|
return messageList.filter { item in
|
||||||
|
guard let message = item.0.first else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let inclusion = transaction.getPeerChatListInclusion(message.id.peerId)
|
||||||
|
if case .notIncluded = inclusion {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|> deliverOn(Queue.mainQueue())).start(next: { [weak self] messageList in
|
|> deliverOn(Queue.mainQueue())).start(next: { [weak self] messageList in
|
||||||
|
if messageList.isEmpty {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if let strongSelf = self, let (messages, _, notify) = messageList.last, let firstMessage = messages.first {
|
if let strongSelf = self, let (messages, _, notify) = messageList.last, let firstMessage = messages.first {
|
||||||
if UIApplication.shared.applicationState == .active {
|
if UIApplication.shared.applicationState == .active {
|
||||||
var chatIsVisible = false
|
var chatIsVisible = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user