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

Fix #8457: Only update toolbar layout when actually required #8458

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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