Avoid unneeded navbar and toolbar visibility changes in article view to avoid (hopefully) a UINavigationBar assertion during transitions.

This commit is contained in:
Brent Simmons committed 2026-11-27 21:09:35 -08:00
1 parent 7289c76b64
commit 3e637be1ba
1 file changed
+15 -4
+15 -4
View File
@@ -302,8 +302,7 @@ final class WebViewController: UIViewController {
coordinator.showStatusBar()
topShowBarsViewConstraint?.constant = 0
bottomShowBarsViewConstraint?.constant = 0
navigationController?.setNavigationBarHidden(false, animated: animated)
navigationController?.setToolbarHidden(false, animated: animated)
setBarsHidden(false, animated: animated)
additionalSafeAreaInsets.bottom = 0
setBottomScrollEdgeEffectHidden(false)
configureContextMenuInteraction()
@@ -315,13 +314,25 @@ final class WebViewController: UIViewController {
coordinator.hideStatusBar()
topShowBarsViewConstraint?.constant = -44.0
bottomShowBarsViewConstraint?.constant = 44.0
navigationController?.setNavigationBarHidden(true, animated: true)
navigationController?.setToolbarHidden(true, animated: true)
setBarsHidden(true, animated: true)
setBottomScrollEdgeEffectHidden(true)
configureContextMenuInteraction()
}
}
/// Skips calls that wouldn’t change anything.
private func setBarsHidden(_ hidden: Bool, animated: Bool) {
guard let navigationController else {
return
}
if navigationController.isNavigationBarHidden != hidden {
navigationController.setNavigationBarHidden(hidden, animated: animated)
}
if navigationController.isToolbarHidden != hidden {
navigationController.setToolbarHidden(hidden, animated: animated)
}
}
func toggleArticleExtractor() {
guard let article = article else {