Browser improvements

This commit is contained in:
Ilya Laktyushin
2024-07-25 16:15:45 +02:00
parent 3e99101e07
commit 2eeb3be2b2
15 changed files with 131 additions and 16 deletions

View File

@@ -1189,7 +1189,7 @@ public class BrowserScreen: ViewController, MinimizableController {
private let context: AccountContext
private let subject: Subject
var openPreviousOnClose = false
private var openPreviousOnClose = false
private var validLayout: ContainerViewLayout?
@@ -1205,9 +1205,10 @@ public class BrowserScreen: ViewController, MinimizableController {
// "application/vnd.openxmlformats-officedocument.presentationml.presentation"
]
public init(context: AccountContext, subject: Subject) {
public init(context: AccountContext, subject: Subject, openPreviousOnClose: Bool = false) {
self.context = context
self.subject = subject
self.openPreviousOnClose = openPreviousOnClose
super.init(navigationBarPresentationData: nil)
@@ -1243,9 +1244,18 @@ public class BrowserScreen: ViewController, MinimizableController {
}
public func requestMinimize(topEdgeOffset: CGFloat?, initialVelocity: CGFloat?) {
self.openPreviousOnClose = false
self.node.minimize(topEdgeOffset: topEdgeOffset, damping: 180.0, initialVelocity: initialVelocity)
}
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if self.openPreviousOnClose, let navigationController = self.navigationController as? NavigationController, let minimizedContainer = navigationController.minimizedContainer, let controller = minimizedContainer.controllers.last {
navigationController.maximizeViewController(controller, animated: true)
}
}
public var isMinimized = false {
didSet {
if let webContent = self.node.content.last as? BrowserWebContent {