Skip to content

Commit 82256eb

Browse files
committed
Secrets recovery: fix an issue preventing the release of SecureBackupSetupCoordinator
1 parent 9441f69 commit 82256eb

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@ final class SecretsRecoveryCoordinator: SecretsRecoveryCoordinatorType {
121121
private func showSecureBackupSetup(checkKeyBackup: Bool) {
122122
let coordinator = SecureBackupSetupCoordinator(session: self.session, checkKeyBackup: checkKeyBackup, navigationRouter: self.navigationRouter, cancellable: self.cancellable)
123123
coordinator.delegate = self
124-
coordinator.start()
125-
126-
self.navigationRouter.push(coordinator.toPresentable(), animated: true, popCompletion: { [weak self] in
124+
// Fix: calling coordinator.start() will update the navigationRouter without a popCompletion
125+
coordinator.start(popCompletion: { [weak self] in
127126
self?.remove(childCoordinator: coordinator)
128127
})
128+
// Fix: do not push the presentable from the coordinator to the navigation router as this has already been done by coordinator.start().
129+
// Also, coordinator.toPresentable() returns a navigation controller, which cannot be pushed into a navigation router.
129130
self.add(childCoordinator: coordinator)
130131
}
131132
}

Riot/Modules/SecureBackup/Setup/SecureBackupSetupCoordinator.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
7373
// MARK: - Public methods
7474

7575
func start() {
76+
start(popCompletion: nil)
77+
}
78+
79+
func start(popCompletion: (() -> Void)?) {
7680
let rootViewController = self.createIntro()
7781

7882
if self.navigationRouter.modules.isEmpty == false {
79-
self.navigationRouter.push(rootViewController, animated: true, popCompletion: nil)
83+
self.navigationRouter.push(rootViewController, animated: true, popCompletion: popCompletion)
8084
} else {
81-
self.navigationRouter.setRootModule(rootViewController)
85+
self.navigationRouter.setRootModule(rootViewController, popCompletion: popCompletion)
8286
}
8387
}
84-
88+
8589
func toPresentable() -> UIViewController {
8690
return self.navigationRouter
8791
.toPresentable()

0 commit comments

Comments
 (0)