Fix navigationStackCoordinator getting torn down when being reset on … (#613)

* Fix navigationStackCoordinator getting torn down when being reset on the navigationSplitCoordinator, added unit tests for it

* Guard against using the same coordinator more than once
This commit is contained in:
Stefan Ceriu
2023-02-23 16:01:48 +02:00
committed by GitHub
parent 99d6caed4e
commit ad06e812bc
4 changed files with 39 additions and 3 deletions
@@ -168,8 +168,7 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
emojiProvider: emojiProvider)
let coordinator = RoomScreenCoordinator(parameters: parameters)
detailNavigationStackCoordinator.setRootCoordinator(coordinator)
navigationSplitCoordinator.setDetailCoordinator(detailNavigationStackCoordinator) { [weak self, roomIdentifier] in
detailNavigationStackCoordinator.setRootCoordinator(coordinator) { [weak self, roomIdentifier] in
guard let self else { return }
// Move the state machine to no room selected if the room currently being dimissed
@@ -180,6 +179,10 @@ class UserSessionFlowCoordinator: CoordinatorProtocol {
self.detailNavigationStackCoordinator.setRootCoordinator(nil)
}
}
if navigationSplitCoordinator.detailCoordinator == nil {
navigationSplitCoordinator.setDetailCoordinator(detailNavigationStackCoordinator)
}
}
}