From 5b62ee03249083df5769c39511430088c142208f Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Wed, 15 Nov 2023 17:29:12 -0500 Subject: [PATCH] Fix #8421: Update the toolbar layout on `viewWillAppear` 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 02fc2712fa7..3d1c08651b4 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -1108,6 +1108,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 {