Secrets recovery: fix an issue preventing the release of SecureBackupSetupCoordinator

This commit is contained in:
Nicolas Mauri
2023-03-03 10:02:57 +01:00
parent ac0594d033
commit 2c1d56ece9
2 changed files with 11 additions and 6 deletions
@@ -121,11 +121,12 @@ final class SecretsRecoveryCoordinator: SecretsRecoveryCoordinatorType {
private func showSecureBackupSetup(checkKeyBackup: Bool) {
let coordinator = SecureBackupSetupCoordinator(session: self.session, checkKeyBackup: checkKeyBackup, navigationRouter: self.navigationRouter, cancellable: self.cancellable)
coordinator.delegate = self
coordinator.start()
self.navigationRouter.push(coordinator.toPresentable(), animated: true, popCompletion: { [weak self] in
// Fix: calling coordinator.start() will update the navigationRouter without a popCompletion
coordinator.start(popCompletion: { [weak self] in
self?.remove(childCoordinator: coordinator)
})
// Fix: do not push the presentable from the coordinator to the navigation router as this has already been done by coordinator.start().
// Also, coordinator.toPresentable() returns a navigation controller, which cannot be pushed into a navigation router.
self.add(childCoordinator: coordinator)
}
}