mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Add forwarding to multiple people simultaneously
This commit is contained in:
@@ -20,6 +20,7 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
private var customTitle: String?
|
||||
|
||||
public var peerSelected: ((Peer) -> Void)?
|
||||
public var multiplePeersSelected: (([Peer], NSAttributedString) -> Void)?
|
||||
private let filter: ChatListNodePeersFilter
|
||||
|
||||
private let attemptSelection: ((Peer) -> Void)?
|
||||
@@ -124,6 +125,10 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
self?.activateSearch()
|
||||
})
|
||||
self.navigationBar?.setContentNode(self.searchContentNode, animated: false)
|
||||
|
||||
if params.multipleSelection {
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Select, style: .plain, target: self, action: #selector(self.beginSelection))
|
||||
}
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
@@ -152,6 +157,10 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
|
||||
self.peerSelectionNode.navigationBar = self.navigationBar
|
||||
|
||||
self.peerSelectionNode.requestSend = { [weak self] peers, text in
|
||||
self?.multiplePeersSelected?(peers, text)
|
||||
}
|
||||
|
||||
self.peerSelectionNode.requestDeactivateSearch = { [weak self] in
|
||||
self?.deactivateSearch()
|
||||
}
|
||||
@@ -220,6 +229,11 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
self.peerSelectionNode.containerLayoutUpdated(layout, navigationBarHeight: self.cleanNavigationHeight, actualNavigationBarHeight: self.navigationLayout(layout: layout).navigationFrame.maxY, transition: transition)
|
||||
}
|
||||
|
||||
@objc private func beginSelection() {
|
||||
self.navigationItem.rightBarButtonItem = nil
|
||||
self.peerSelectionNode.beginSelection()
|
||||
}
|
||||
|
||||
@objc func cancelPressed() {
|
||||
if let customDismiss = self.customDismiss {
|
||||
customDismiss()
|
||||
|
||||
Reference in New Issue
Block a user