2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

Fix broken login navigation since removal of NeedsDependency

If a view controller is now buried in a navigation stack, its view will have no window to find the correct SceneDelegate with. So look for a navigation controller if the initial look up fails.
This commit is contained in:
shannon 2024-12-03 15:19:51 -05:00
parent 65bf555d98
commit c927ca278b

View File

@ -689,6 +689,12 @@ extension SceneCoordinator: SettingsCoordinatorDelegate {
public extension UIViewController {
var sceneCoordinator: SceneCoordinator? {
guard let view = viewIfLoaded else { assert(false); return nil }
return SceneCoordinator.coordinator(for: view)
if let coordinator = SceneCoordinator.coordinator(for: view) {
return coordinator
}
if let navView = navigationController?.view {
return SceneCoordinator.coordinator(for: navView)
}
return nil
}
}