mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[WIP] Topics
This commit is contained in:
@@ -18,11 +18,12 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
|
||||
private var customTitle: String?
|
||||
|
||||
public var peerSelected: ((Peer) -> Void)?
|
||||
public var peerSelected: ((Peer, Int64?) -> Void)?
|
||||
public var multiplePeersSelected: (([Peer], [PeerId: Peer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)?
|
||||
private let filter: ChatListNodePeersFilter
|
||||
private let forumPeerId: EnginePeer.Id?
|
||||
|
||||
private let attemptSelection: ((Peer) -> Void)?
|
||||
private let attemptSelection: ((Peer, Int64?) -> Void)?
|
||||
private let createNewGroup: (() -> Void)?
|
||||
|
||||
public var inProgress: Bool = false {
|
||||
@@ -80,6 +81,7 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
public init(_ params: PeerSelectionControllerParams) {
|
||||
self.context = params.context
|
||||
self.filter = params.filter
|
||||
self.forumPeerId = params.forumPeerId
|
||||
self.hasChatListSelector = params.hasChatListSelector
|
||||
self.hasContactSelector = params.hasContactSelector
|
||||
self.hasGlobalSearch = params.hasGlobalSearch
|
||||
@@ -153,7 +155,7 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
}
|
||||
|
||||
override public func loadDisplayNode() {
|
||||
self.displayNode = PeerSelectionControllerNode(context: self.context, presentationData: self.presentationData, filter: self.filter, hasChatListSelector: self.hasChatListSelector, hasContactSelector: self.hasContactSelector, hasGlobalSearch: self.hasGlobalSearch, forwardedMessageIds: self.forwardedMessageIds, hasTypeHeaders: self.hasTypeHeaders, createNewGroup: self.createNewGroup, present: { [weak self] c, a in
|
||||
self.displayNode = PeerSelectionControllerNode(context: self.context, presentationData: self.presentationData, filter: self.filter, forumPeerId: self.forumPeerId, hasChatListSelector: self.hasChatListSelector, hasContactSelector: self.hasContactSelector, hasGlobalSearch: self.hasGlobalSearch, forwardedMessageIds: self.forwardedMessageIds, hasTypeHeaders: self.hasTypeHeaders, createNewGroup: self.createNewGroup, present: { [weak self] c, a in
|
||||
self?.present(c, in: .window(.root), with: a)
|
||||
}, presentInGlobalOverlay: { [weak self] c, a in
|
||||
self?.presentInGlobalOverlay(c, with: a)
|
||||
@@ -175,24 +177,24 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
self?.activateSearch()
|
||||
}
|
||||
|
||||
self.peerSelectionNode.requestOpenPeer = { [weak self] peer in
|
||||
self.peerSelectionNode.requestOpenPeer = { [weak self] peer, threadId in
|
||||
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
||||
peerSelected(peer)
|
||||
peerSelected(peer, threadId)
|
||||
}
|
||||
}
|
||||
|
||||
self.peerSelectionNode.requestOpenDisabledPeer = { [weak self] peer in
|
||||
self.peerSelectionNode.requestOpenDisabledPeer = { [weak self] peer, threadId in
|
||||
if let strongSelf = self {
|
||||
strongSelf.attemptSelection?(peer)
|
||||
strongSelf.attemptSelection?(peer, threadId)
|
||||
}
|
||||
}
|
||||
|
||||
self.peerSelectionNode.requestOpenPeerFromSearch = { [weak self] peer in
|
||||
self.peerSelectionNode.requestOpenPeerFromSearch = { [weak self] peer, threadId in
|
||||
if let strongSelf = self {
|
||||
strongSelf.openMessageFromSearchDisposable.set((strongSelf.context.engine.peers.ensurePeerIsLocallyAvailable(peer: EnginePeer(peer))
|
||||
|> deliverOnMainQueue).start(completed: { [weak strongSelf] in
|
||||
if let strongSelf = strongSelf, let peerSelected = strongSelf.peerSelected {
|
||||
peerSelected(peer)
|
||||
peerSelected(peer, threadId)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user