From 3efaa7005dae4b32c4d5b221f2d83f1616a8c0cb Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 16 Nov 2023 10:26:04 -0500 Subject: [PATCH] Fix brave/brave-ios#8421: Update the toolbar layout on `viewWillAppear` (brave/brave-ios#8422) On iOS 17 rotating the device with a full screen modal presented (e.g. Playlist, Tab Tray) to landscape then back to portrait does not trigger `traitCollectionDidChange`/`willTransition`/etc calls and so the toolbar remains in the wrong state. --- Sources/Brave/Frontend/Browser/BrowserViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index 99ad9e60bf7b..7c944c95b331 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -1109,6 +1109,12 @@ public class BrowserViewController: UIViewController { override public func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + if #available(iOS 17, *) { + // On iOS 17 rotating the device with a full screen modal presented (e.g. Playlist, Tab Tray) + // to landscape then back to portrait does not trigger `traitCollectionDidChange`/`willTransition`/etc + // calls and so the toolbar remains in the wrong state. + updateToolbarStateForTraitCollection(traitCollection) + } updateToolbarUsingTabManager(tabManager) if let tabId = tabManager.selectedTab?.rewardsId, rewards.rewardsAPI?.selectedTabId == 0 {