From fb8a13a76a0c01d75c98a9c60fbaa06981fd0d80 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 16 Nov 2023 10:26:04 -0500 Subject: [PATCH] Fix #8421: Update the toolbar layout on `viewWillAppear` (#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 99ad9e60bf7..7c944c95b33 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 {