Present SFSafariViewController using .overFullScreen instead of default .fullScreen — avoids a crash in -[UINavigationBar layoutSubviews]. Fix #4418.

This commit is contained in:
Brent Simmons
2024-12-05 22:06:00 -08:00
parent e3329e33f7
commit df8b404e1d
2 changed files with 10 additions and 6 deletions

View File

@@ -273,8 +273,7 @@ class WebViewController: UIViewController {
if AppDefaults.shared.useSystemBrowser {
UIApplication.shared.open(url, options: [:])
} else {
let vc = SFSafariViewController(url: url)
present(vc, animated: true)
openURLInSafariViewController(url)
}
}
}
@@ -378,8 +377,7 @@ extension WebViewController: WKNavigationDelegate {
guard didOpen == false else {
return
}
let vc = SFSafariViewController(url: url)
self.present(vc, animated: true)
self.openURLInSafariViewController(url)
}
}
@@ -794,11 +792,16 @@ private extension WebViewController {
guard didOpen == false else {
return
}
let vc = SFSafariViewController(url: url)
self.present(vc, animated: true)
self.openURLInSafariViewController(url)
}
}
func openURLInSafariViewController(_ url: URL) {
let viewController = SFSafariViewController(url: url)
viewController.modalPresentationStyle = .overFullScreen // This avoids a crash with .fullScreen
present(viewController, animated: true)
}
}
// MARK: Find in Article

View File

@@ -676,6 +676,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
if let indexPath = coordinator.currentFeedIndexPath,
let url = coordinator.homePageURLForFeed(indexPath) {
let vc = SFSafariViewController(url: url)
vc.modalPresentationStyle = .overFullScreen
present(vc, animated: true)
}
}