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, _, _, _, _):
|
||||
if let channel = renderedPeer.peer as? TelegramChannel, channel.flags.contains(.hasActiveVoiceChat) {
|
||||
result.append(channel)
|
||||
} else if let group = renderedPeer.peer as? TelegramGroup, group.flags.contains(.hasActiveVoiceChat) {
|
||||
result.append(group)
|
||||
}
|
||||
default:
|
||||
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)
|
||||
contentHeight = max(contentHeight, actionsSize.height + originalActionsFrame.minY + actionsBottomInset)
|
||||
|
||||
var overflowOffset: CGFloat
|
||||
var contentContainerFrame: CGRect
|
||||
|
@ -1309,10 +1309,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
return rawAdminIds
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
|
||||
let myPeerId = self.joinAsPeerId
|
||||
|
||||
var initialState = initialState
|
||||
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(
|
||||
@ -1325,7 +1327,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
)
|
||||
self.temporaryParticipantsContext = nil
|
||||
self.participantsContext = participantsContext
|
||||
let myPeerId = self.joinAsPeerId
|
||||
let myPeer = self.accountContext.account.postbox.transaction { transaction -> (Peer, CachedPeerData?)? in
|
||||
if let peer = transaction.getPeer(myPeerId) {
|
||||
return (peer, transaction.getPeerCachedData(peerId: myPeerId))
|
||||
|
@ -2345,8 +2345,8 @@ public final class VoiceChatController: ViewController {
|
||||
return
|
||||
}
|
||||
self.isFullscreen = isFullscreen
|
||||
|
||||
self.controller?.statusBar.statusBarStyle = isFullscreen ? .White : .Ignore
|
||||
|
||||
self.controller?.statusBar.updateStatusBarStyle(isFullscreen ? .White : .Ignore, animated: true)
|
||||
|
||||
var size = layout.size
|
||||
if case .regular = layout.metrics.widthClass {
|
||||
|
@ -452,7 +452,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
||||
var apiUsers: [Api.User] = []
|
||||
let apiUsers: [Api.User] = []
|
||||
|
||||
state.adminIds = Set(peerAdminIds)
|
||||
|
||||
@ -755,7 +755,7 @@ public final class GroupCallParticipantsContext {
|
||||
public var totalCount: Int
|
||||
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] = [:]
|
||||
for i in 0 ..< other.participants.count {
|
||||
indexMap[other.participants[i].peer.id] = i
|
||||
@ -764,6 +764,9 @@ public final class GroupCallParticipantsContext {
|
||||
for i in 0 ..< self.participants.count {
|
||||
if let index = indexMap[self.participants[i].peer.id] {
|
||||
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()
|
||||
continue
|
||||
}
|
||||
var previousJoinTimestamp: Int32?
|
||||
var previousActivityTimestamp: Double?
|
||||
var previousActivityRank: Int?
|
||||
if let index = updatedParticipants.firstIndex(where: { $0.peer.id == participantUpdate.peerId }) {
|
||||
previousJoinTimestamp = updatedParticipants[index].joinTimestamp
|
||||
previousActivityTimestamp = updatedParticipants[index].activityTimestamp
|
||||
previousActivityRank = updatedParticipants[index].activityRank
|
||||
updatedParticipants.remove(at: index)
|
||||
@ -1302,7 +1307,7 @@ public final class GroupCallParticipantsContext {
|
||||
updatedTotalCount += 1
|
||||
strongSelf.memberEventsPipe.putNext(MemberEvent(peerId: participantUpdate.peerId, joined: true))
|
||||
}
|
||||
|
||||
|
||||
var activityTimestamp: Double?
|
||||
if let previousActivityTimestamp = previousActivityTimestamp, let updatedActivityTimestamp = participantUpdate.activityTimestamp {
|
||||
activityTimestamp = max(updatedActivityTimestamp, previousActivityTimestamp)
|
||||
@ -1314,7 +1319,7 @@ public final class GroupCallParticipantsContext {
|
||||
peer: peer,
|
||||
ssrc: participantUpdate.ssrc,
|
||||
jsonParams: participantUpdate.jsonParams,
|
||||
joinTimestamp: participantUpdate.joinTimestamp,
|
||||
joinTimestamp: previousJoinTimestamp ?? participantUpdate.joinTimestamp,
|
||||
raiseHandRating: participantUpdate.raiseHandRating,
|
||||
hasRaiseHand: participantUpdate.raiseHandRating != nil,
|
||||
activityTimestamp: activityTimestamp,
|
||||
@ -1777,9 +1782,8 @@ public func groupCallDisplayAsAvailablePeers(network: Network, postbox: Postbox,
|
||||
return network.request(Api.functions.phone.getGroupCallJoinAs(peer: inputPeer))
|
||||
|> retryRequest
|
||||
|> mapToSignal { result in
|
||||
var peers:[Peer]
|
||||
switch result {
|
||||
case let .joinAsPeers(peers, chats, users):
|
||||
case let .joinAsPeers(_, chats, _):
|
||||
var subscribers: [PeerId: Int32] = [:]
|
||||
let peers = chats.compactMap(parseTelegramGroupOrChannel)
|
||||
for chat in chats {
|
||||
|
@ -257,9 +257,28 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
|
||||
let postbox = context.account.postbox
|
||||
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
|
||||
if messageList.isEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
if let strongSelf = self, let (messages, _, notify) = messageList.last, let firstMessage = messages.first {
|
||||
if UIApplication.shared.applicationState == .active {
|
||||
var chatIsVisible = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user