From c44bdbed468ce7de814136cce8e5665c72b3db3a Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 13 Jan 2025 12:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fixes=20#4483=20=20by?= =?UTF-8?q?=20showing=20bars=20on=20rotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On rotation, if the device is a .phone and it is transitioning to a `.regular` horizontal size class—it’s big—bars in the article view are surfaced to workaround a crash. This doesn’t affect behaviour on smaller iPhones or iPads. --- iOS/Article/ArticleViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index ae6e73837..055c54849 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -189,6 +189,14 @@ class ArticleViewController: UIViewController { view.layoutIfNeeded() } + override func willTransition(to newCollection: UITraitCollection, with coordinator: any UIViewControllerTransitionCoordinator) { + // We only want to show bars when rotating to horizontalSizeClass == .regular + // (i.e., big) iPhones to resolve crash #4483. + if UIDevice.current.userInterfaceIdiom == .phone && newCollection.horizontalSizeClass == .regular { + currentWebViewController?.showBars() + } + } + func updateUI() { guard let article = article else {