diff --git a/submodules/Display/Display/TabBarController.swift b/submodules/Display/Display/TabBarController.swift index 1fe3f04a1f..517a548e09 100644 --- a/submodules/Display/Display/TabBarController.swift +++ b/submodules/Display/Display/TabBarController.swift @@ -107,6 +107,14 @@ open class TabBarController: ViewController { var currentController: ViewController? + open override var navigationBarRequiresEntireLayoutUpdate: Bool { + if let currentController = currentController { + return currentController.navigationBarRequiresEntireLayoutUpdate + } else { + return false + } + } + private let pendingControllerDisposable = MetaDisposable() private var theme: TabBarControllerTheme diff --git a/submodules/Display/Display/ViewController.swift b/submodules/Display/Display/ViewController.swift index 6f5ea48045..56e3fc2848 100644 --- a/submodules/Display/Display/ViewController.swift +++ b/submodules/Display/Display/ViewController.swift @@ -140,6 +140,9 @@ open class ViewControllerPresentationArguments { private var previewingContext: Any? public var displayNavigationBar = true + open var navigationBarRequiresEntireLayoutUpdate: Bool { + return true + } private weak var activeInputViewCandidate: UIResponder? private weak var activeInputView: UIResponder? @@ -258,7 +261,11 @@ open class ViewControllerPresentationArguments { } self.navigationBar?.requestContainerLayout = { [weak self] transition in if let strongSelf = self, strongSelf.isNodeLoaded, let validLayout = strongSelf.validLayout { - strongSelf.updateNavigationBarLayout(validLayout, transition: transition) + if strongSelf.navigationBarRequiresEntireLayoutUpdate { + strongSelf.containerLayoutUpdated(validLayout, transition: transition) + } else { + strongSelf.updateNavigationBarLayout(validLayout, transition: transition) + } } } self.navigationBar?.item = self.navigationItem diff --git a/submodules/TelegramUI/TelegramUI/SettingsController.swift b/submodules/TelegramUI/TelegramUI/SettingsController.swift index 724bd660ff..3fce416b9e 100644 --- a/submodules/TelegramUI/TelegramUI/SettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/SettingsController.swift @@ -544,6 +544,10 @@ private final class SettingsControllerImpl: ItemListController, S weak var switchController: TabBarAccountSwitchController? + override var navigationBarRequiresEntireLayoutUpdate: Bool { + return false + } + init(currentContext: AccountContext, contextValue: Promise, state: Signal<(ItemListControllerState, (ItemListNodeState, SettingsEntry.ItemGenerationArguments)), NoError>, tabBarItem: Signal?, accountsAndPeers: Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError>) { self.sharedContext = currentContext.sharedContext self.contextValue = contextValue @@ -1435,7 +1439,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM return state } } - + setDisplayNavigationBarImpl = { [weak controller] display in controller?.setDisplayNavigationBar(display, transition: .animated(duration: 0.5, curve: .spring)) }