Fix presentation context ordering

This commit is contained in:
Ali 2019-11-05 22:17:29 +04:00
parent 2707476621
commit 8d54a41f19
3 changed files with 19 additions and 5 deletions

View File

@ -56,7 +56,7 @@ public final class PresentationContext {
private var presentationDisposables = DisposableSet()
var topLevelSubview: UIView?
var topLevelSubview: () -> UIView? = { nil }
var isCurrentlyOpaque: Bool {
for (controller, _) in self.controllers {
@ -93,7 +93,7 @@ public final class PresentationContext {
if let topController = topController {
return topController.view
} else {
return self.topLevelSubview
return self.topLevelSubview()
}
}
@ -259,7 +259,7 @@ public final class PresentationContext {
if let view = self.view, let layout = self.layout {
for (controller, _) in self.controllers {
controller.viewWillAppear(false)
if let topLevelSubview = self.topLevelSubview {
if let topLevelSubview = self.topLevelSubview() {
view.insertSubview(controller.view, belowSubview: topLevelSubview)
} else {
view.addSubview(controller.view)

View File

@ -250,6 +250,9 @@ public enum ViewControllerNavigationPresentation {
return nil
}
open func didAppearInContextPreview() {
}
private func updateScrollToTopView() {
/*if self.scrollToTop != nil {
if let displayNode = self._displayNode , self.scrollToTopView == nil {

View File

@ -318,6 +318,19 @@ public class Window1 {
self.overlayPresentationContext = GlobalOverlayPresentationContext(statusBarHost: statusBarHost, parentView: self.hostView.containerView)
self.topPresentationContext = PresentationContext()
self.presentationContext.topLevelSubview = { [weak self] in
guard let strongSelf = self else {
return nil
}
if let first = strongSelf.topPresentationContext.controllers.first {
return first.0.displayNode.view
}
if let first = strongSelf._topLevelOverlayControllers.first {
return first.view
}
return nil
}
self.presentationContext.updateIsInteractionBlocked = { [weak self] value in
self?.isInteractionBlocked = value
}
@ -762,8 +775,6 @@ public class Window1 {
}
}
}
self.presentationContext.topLevelSubview = self._topLevelOverlayControllers.first?.view
}
}