Skip to content

Commit

Permalink
Fix brave/brave-ios#8457: Only update toolbar layout when actually re…
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson authored Nov 22, 2023
1 parent 3307199 commit 61ccdcd
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 @@ -625,25 +625,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 61ccdcd

Please sign in to comment.