mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Merge commit 'c64653ed37'
This commit is contained in:
parent
7a7333edab
commit
91eb779ae2
614 changed files with 33270 additions and 37190 deletions
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
|
@ -357,19 +356,19 @@ public final class CallController: ViewController {
|
|||
self.superDismiss()
|
||||
}
|
||||
|
||||
let callPeerView: Signal<PeerView?, NoError>
|
||||
callPeerView = self.account.postbox.peerView(id: self.call.peerId) |> map(Optional.init)
|
||||
|
||||
let callPeerView: Signal<EnginePeer?, NoError>
|
||||
callPeerView = TelegramEngine(account: self.account).data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: self.call.peerId))
|
||||
|
||||
self.peerDisposable = (combineLatest(queue: .mainQueue(),
|
||||
self.account.postbox.peerView(id: self.account.peerId) |> take(1),
|
||||
TelegramEngine(account: self.account).data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: self.account.peerId)) |> take(1),
|
||||
callPeerView,
|
||||
self.sharedContext.activeAccountsWithInfo |> take(1)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] accountView, view, activeAccountsWithInfo in
|
||||
if let strongSelf = self {
|
||||
if let view {
|
||||
if let accountPeer = accountView.peers[accountView.peerId], let peer = view.peers[view.peerId] {
|
||||
strongSelf.controllerNode.updatePeer(accountPeer: EnginePeer(accountPeer), peer: EnginePeer(peer), hasOther: activeAccountsWithInfo.accounts.count > 1)
|
||||
if let accountPeer = accountView {
|
||||
strongSelf.controllerNode.updatePeer(accountPeer: accountPeer, peer: view, hasOther: activeAccountsWithInfo.accounts.count > 1)
|
||||
strongSelf.isDataReady.set(.single(true))
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ public func callFeedbackController(sharedContext: SharedAccountContext, account:
|
|||
let signal = combineLatest(sharedContext.presentationData, statePromise.get())
|
||||
|> deliverOnMainQueue
|
||||
|> map { presentationData, state -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
||||
let leftNavigationButton = ItemListNavigationButton(content: .icon(.close), style: .regular, enabled: true, action: {
|
||||
dismissImpl?()
|
||||
})
|
||||
let rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.CallFeedback_Send), style: .bold, enabled: true, action: {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -368,9 +367,9 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
strongSelf.update()
|
||||
}
|
||||
}))
|
||||
let callPeerView: Signal<PeerView?, NoError>
|
||||
let callPeerView: Signal<EnginePeer?, NoError>
|
||||
if let peerId = call.peerId {
|
||||
callPeerView = account.postbox.peerView(id: peerId) |> map(Optional.init)
|
||||
callPeerView = TelegramEngine(account: account).data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
|
||||
} else {
|
||||
callPeerView = .single(nil)
|
||||
}
|
||||
|
|
@ -384,7 +383,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
|> deliverOnMainQueue).start(next: { [weak self] view, state, isMuted, members in
|
||||
if let strongSelf = self {
|
||||
if let view {
|
||||
strongSelf.currentPeer = view.peers[view.peerId].flatMap(EnginePeer.init)
|
||||
strongSelf.currentPeer = view
|
||||
} else {
|
||||
strongSelf.currentPeer = nil
|
||||
}
|
||||
|
|
@ -429,14 +428,14 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
var effectiveLevel: Float = 0.0
|
||||
var audioLevels = audioLevels
|
||||
if !strongSelf.currentIsMuted {
|
||||
audioLevels.append((PeerId(0), 0, myAudioLevel, true))
|
||||
audioLevels.append((EnginePeer.Id(0), 0, myAudioLevel, true))
|
||||
}
|
||||
effectiveLevel = audioLevels.map { $0.2 }.max() ?? 0.0
|
||||
strongSelf.backgroundNode.audioLevel = effectiveLevel
|
||||
}))
|
||||
|
||||
if let groupCall = call as? PresentationGroupCallImpl {
|
||||
let _ = (allowedStoryReactions(account: account)
|
||||
let _ = (allowedStoryReactions(engine: TelegramEngine(account: account))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] reactionItems in
|
||||
self?.reactionItems = reactionItems
|
||||
})
|
||||
|
|
@ -479,19 +478,19 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
membersCount = 1
|
||||
}
|
||||
|
||||
var speakingPeer: Peer?
|
||||
var speakingPeer: EnginePeer?
|
||||
if let members = currentMembers {
|
||||
var speakingPeers: [Peer] = []
|
||||
var speakingPeers: [EnginePeer] = []
|
||||
for member in members.participants {
|
||||
if let memberPeer = member.peer, members.speakingParticipants.contains(memberPeer.id) {
|
||||
speakingPeers.append(memberPeer._asPeer())
|
||||
speakingPeers.append(memberPeer)
|
||||
}
|
||||
}
|
||||
speakingPeer = speakingPeers.first
|
||||
}
|
||||
|
||||
|
||||
if let speakingPeer = speakingPeer {
|
||||
speakerSubtitle = EnginePeer(speakingPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
speakerSubtitle = speakingPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
displaySpeakerSubtitle = speakerSubtitle != title && !speakerSubtitle.isEmpty
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
|
|
|||
|
|
@ -1497,7 +1497,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||
if let peerId {
|
||||
if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
rawAdminIds = Signal { subscriber in
|
||||
let (disposable, _) = accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: accountContext.engine, postbox: accountContext.account.postbox, network: accountContext.account.network, accountPeerId: accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
let (disposable, _) = accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: accountContext.engine, accountPeerId: accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
var peerIds = Set<PeerId>()
|
||||
for item in list.list {
|
||||
if let adminInfo = item.participant.adminInfo, adminInfo.rights.rights.contains(.canManageCalls) {
|
||||
|
|
@ -1982,7 +1982,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||
return EmptyDisposable
|
||||
}
|
||||
|
||||
let (disposable, _) = self.accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: self.accountContext.engine, postbox: self.accountContext.account.postbox, network: self.accountContext.account.network, accountPeerId: self.accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
let (disposable, _) = self.accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: self.accountContext.engine, accountPeerId: self.accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
var peerIds = Set<PeerId>()
|
||||
for item in list.list {
|
||||
if let adminInfo = item.participant.adminInfo, adminInfo.rights.rights.contains(.canManageCalls) {
|
||||
|
|
@ -2326,7 +2326,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||
if let peerId = peerId ?? self.streamPeerId {
|
||||
if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
rawAdminIds = Signal { subscriber in
|
||||
let (disposable, _) = accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: accountContext.engine, postbox: accountContext.account.postbox, network: accountContext.account.network, accountPeerId: accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
let (disposable, _) = accountContext.peerChannelMemberCategoriesContextsManager.admins(engine: accountContext.engine, accountPeerId: accountContext.account.peerId, peerId: peerId, updated: { list in
|
||||
var peerIds = Set<PeerId>()
|
||||
for item in list.list {
|
||||
if let adminInfo = item.participant.adminInfo, adminInfo.rights.rights.contains(.canManageCalls) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import AsyncDisplayKit
|
|||
import Display
|
||||
import ComponentFlow
|
||||
import ViewControllerComponent
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import PlainButtonComponent
|
||||
|
|
@ -1419,7 +1418,7 @@ final class VideoChatScreenComponent: Component {
|
|||
)
|
||||
self.inputMediaInteraction?.forceTheme = defaultDarkColorPresentationTheme
|
||||
|
||||
let _ = (allowedStoryReactions(account: context.account)
|
||||
let _ = (allowedStoryReactions(engine: context.engine)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] reactionItems in
|
||||
self?.reactionItems = reactionItems
|
||||
})
|
||||
|
|
@ -4269,20 +4268,16 @@ private func hasFirstResponder(_ view: UIView) -> Bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func allowedStoryReactions(account: Account) -> Signal<[ReactionItem], NoError> {
|
||||
let viewKey: PostboxViewKey = .orderedItemList(id: Namespaces.OrderedItemList.CloudTopReactions)
|
||||
let topReactions = account.postbox.combinedView(keys: [viewKey])
|
||||
|> map { views -> [RecentReactionItem] in
|
||||
guard let view = views.views[viewKey] as? OrderedItemListView else {
|
||||
return []
|
||||
}
|
||||
return view.items.compactMap { item -> RecentReactionItem? in
|
||||
func allowedStoryReactions(engine: TelegramEngine) -> Signal<[ReactionItem], NoError> {
|
||||
let topReactions = engine.data.subscribe(TelegramEngine.EngineData.Item.OrderedLists.ListItems(collectionId: Namespaces.OrderedItemList.CloudTopReactions))
|
||||
|> map { items -> [RecentReactionItem] in
|
||||
return items.compactMap { item -> RecentReactionItem? in
|
||||
return item.contents.get(RecentReactionItem.self)
|
||||
}
|
||||
}
|
||||
|
||||
return combineLatest(
|
||||
TelegramEngine(account: account).stickers.availableReactions(),
|
||||
engine.stickers.availableReactions(),
|
||||
topReactions
|
||||
)
|
||||
|> take(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue