Fixed accessory panels and section headers inset from navigation bar

This commit is contained in:
Ilya Laktyushin
2019-07-03 14:29:29 +02:00
parent ed40632f6f
commit acd058a11c
3 changed files with 21 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -544,6 +544,10 @@ private final class SettingsControllerImpl: ItemListController<SettingsEntry>, S
weak var switchController: TabBarAccountSwitchController?
override var navigationBarRequiresEntireLayoutUpdate: Bool {
return false
}
init(currentContext: AccountContext, contextValue: Promise<AccountContext>, state: Signal<(ItemListControllerState, (ItemListNodeState<SettingsEntry>, SettingsEntry.ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>?, 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))
}