Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8457: Only update toolbar layout when actually required (#8458)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson authored and iccub committed Nov 22, 2023
1 parent 7acf281 commit 43329bd
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -617,25 +617,25 @@ public class BrowserViewController: UIViewController {

fileprivate func updateToolbarStateForTraitCollection(_ newCollection: UITraitCollection, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator? = nil) {
let showToolbar = shouldShowFooterForTraitCollection(newCollection)

topToolbar.setShowToolbar(!showToolbar)
toolbar?.removeFromSuperview()
toolbar?.tabToolbarDelegate = nil
toolbar = nil
bottomTouchArea.isEnabled = showToolbar

if showToolbar {
toolbar = BottomToolbarView(privateBrowsingManager: privateBrowsingManager)
toolbar?.setSearchButtonState(url: tabManager.selectedTab?.url)
footer.addSubview(toolbar!)
toolbar?.tabToolbarDelegate = self
toolbar?.menuButton.setBadges(Array(topToolbar.menuButton.badges.keys))
if (showToolbar && toolbar == nil) || (!showToolbar && toolbar != nil) {
topToolbar.setShowToolbar(!showToolbar)
toolbar?.removeFromSuperview()
toolbar?.tabToolbarDelegate = nil
toolbar = nil
bottomTouchArea.isEnabled = showToolbar

if showToolbar {
toolbar = BottomToolbarView(privateBrowsingManager: privateBrowsingManager)
toolbar?.setSearchButtonState(url: tabManager.selectedTab?.url)
footer.addSubview(toolbar!)
toolbar?.tabToolbarDelegate = self
toolbar?.menuButton.setBadges(Array(topToolbar.menuButton.badges.keys))
}
updateToolbarUsingTabManager(tabManager)
updateUsingBottomBar(using: newCollection)

view.setNeedsUpdateConstraints()
}
updateToolbarUsingTabManager(tabManager)
updateUsingBottomBar(using: newCollection)

view.setNeedsUpdateConstraints()

if let tab = tabManager.selectedTab,
let webView = tab.webView {
updateURLBar()
Expand Down

0 comments on commit 43329bd

Please sign in to comment.