mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
no message
This commit is contained in:
@@ -3,17 +3,35 @@ import Display
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
public func navigateToChatController(navigationController: NavigationController, account: Account, peerId: PeerId) {
|
||||
public func navigateToChatController(navigationController: NavigationController, account: Account, chatLocation: ChatLocation, messageId: MessageId? = nil, animated: Bool = true) {
|
||||
var found = false
|
||||
for controller in navigationController.viewControllers {
|
||||
if let controller = controller as? ChatController, controller.peerId == peerId {
|
||||
let _ = navigationController.popToViewController(controller, animated: true)
|
||||
var isFirst = true
|
||||
for controller in navigationController.viewControllers.reversed() {
|
||||
if let controller = controller as? ChatController, controller.chatLocation == chatLocation {
|
||||
if let messageId = messageId {
|
||||
controller.navigateToMessage(id: messageId, animated: isFirst, completion: { [weak navigationController, weak controller] in
|
||||
if let navigationController = navigationController, let controller = controller {
|
||||
let _ = navigationController.popToViewController(controller, animated: animated)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let _ = navigationController.popToViewController(controller, animated: animated)
|
||||
}
|
||||
found = true
|
||||
break
|
||||
}
|
||||
isFirst = false
|
||||
}
|
||||
|
||||
if !found {
|
||||
navigationController.pushViewController(ChatController(account: account, peerId: peerId))
|
||||
navigationController.pushViewController(ChatController(account: account, chatLocation: chatLocation, messageId: messageId))
|
||||
}
|
||||
}
|
||||
|
||||
public func isOverlayControllerForChatNotificationOverlayPresentation(_ controller: ViewController) -> Bool {
|
||||
if controller is GalleryController || controller is AvatarGalleryController || controller is ThemeGalleryController || controller is InstantPageGalleryController {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user