mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-01 12:17:53 +00:00
20 lines
633 B
Swift
20 lines
633 B
Swift
import Foundation
|
|
import Display
|
|
import TelegramCore
|
|
import Postbox
|
|
|
|
public func navigateToChatController(navigationController: NavigationController, account: Account, peerId: PeerId) {
|
|
var found = false
|
|
for controller in navigationController.viewControllers {
|
|
if let controller = controller as? ChatController, controller.peerId == peerId {
|
|
let _ = navigationController.popToViewController(controller, animated: true)
|
|
found = true
|
|
break
|
|
}
|
|
}
|
|
|
|
if !found {
|
|
navigationController.pushViewController(ChatController(account: account, peerId: peerId))
|
|
}
|
|
}
|