mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Roll back the replaceTopController improvement, need to rewrite the call site
This commit is contained in:
@@ -1058,30 +1058,10 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
}
|
||||
|
||||
public func replaceTopController(_ controller: ViewController, animated: Bool, ready: Promise<Bool>? = nil) {
|
||||
ready?.set(.single(true))
|
||||
var controllers = self.viewControllers
|
||||
|
||||
if let rootContainer = self.rootContainer {
|
||||
var controllerToReplace: ViewController?
|
||||
switch rootContainer {
|
||||
case let .flat(container):
|
||||
controllerToReplace = container.controllers.last
|
||||
case let .split(container):
|
||||
controllerToReplace = container.detailControllers.last
|
||||
}
|
||||
if let controllerToReplace = controllerToReplace, let index = controllers.firstIndex(where: { $0 === controllerToReplace }) {
|
||||
controllers[index] = controller
|
||||
ready?.set(controller.ready.get())
|
||||
} else {
|
||||
ready?.set(controller.ready.get())
|
||||
controllers.removeLast()
|
||||
controllers.append(controller)
|
||||
}
|
||||
} else {
|
||||
ready?.set(controller.ready.get())
|
||||
controllers.removeLast()
|
||||
controllers.append(controller)
|
||||
}
|
||||
|
||||
self.setViewControllers(controllers, animated: animated)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user