Pass soft logout credentials on coordinator initialization

This commit is contained in:
ismailgulek
2022-06-08 15:59:52 +03:00
parent 3cd1adb312
commit 7cd40c7a26
6 changed files with 26 additions and 29 deletions
@@ -42,9 +42,6 @@ protocol AuthenticationCoordinatorProtocol: Coordinator, Presentable {
/// Update the screen to display registration or login.
func update(authenticationFlow: AuthenticationFlow)
/// Update the screen to use any credentials to use after a soft logout has taken place.
func update(softLogoutCredentials: MXCredentials)
/// Indicates to the coordinator to display any pending screens if it was created with
/// the `canPresentAdditionalScreens` parameter set to `false`
func presentPendingScreensIfNecessary()
@@ -22,6 +22,8 @@ struct LegacyAuthenticationCoordinatorParameters {
let navigationRouter: NavigationRouterType
/// Whether or not the coordinator should show the loading spinner, key verification etc.
let canPresentAdditionalScreens: Bool
/// The credentials to use if a soft logout has taken place.
let softLogoutCredentials: MXCredentials?
}
/// A coordinator that handles authentication, verification and setting a PIN using the old UIViewController flow for iOS 12 & 13.
@@ -61,6 +63,7 @@ final class LegacyAuthenticationCoordinator: NSObject, AuthenticationCoordinator
self.canPresentAdditionalScreens = parameters.canPresentAdditionalScreens
let authenticationViewController = AuthenticationViewController()
authenticationViewController.softLogoutCredentials = parameters.softLogoutCredentials
self.authenticationViewController = authenticationViewController
// Preload the view as this can a second and lock up the UI at presentation.
@@ -87,10 +90,6 @@ final class LegacyAuthenticationCoordinator: NSObject, AuthenticationCoordinator
authenticationViewController.authType = authenticationFlow.mxkType
}
func update(softLogoutCredentials: MXCredentials) {
authenticationViewController.softLogoutCredentials = softLogoutCredentials
}
func presentPendingScreensIfNecessary() {
canPresentAdditionalScreens = true