Merge the 2 map.

This commit is contained in:
Benoit Marty 2023-06-09 17:55:09 +02:00
parent 8b177645a9
commit b98010d74d

View file

@ -85,12 +85,11 @@ class ConfirmAccountProviderPresenter @AssistedInject constructor(
suspend { suspend {
val domain = tryOrNull { URL(homeserverUrl) }?.host ?: homeserverUrl val domain = tryOrNull { URL(homeserverUrl) }?.host ?: homeserverUrl
authenticationService.setHomeserver(domain).map { authenticationService.setHomeserver(domain).map {
authenticationService.getHomeserverDetails().value!! val matrixHomeServerDetails = authenticationService.getHomeserverDetails().value!!
}.map { if (matrixHomeServerDetails.supportsOidcLogin) {
if (it.supportsOidcLogin) {
// Retrieve the details right now // Retrieve the details right now
LoginFlow.OidcFlow(authenticationService.getOidcUrl().getOrThrow()) LoginFlow.OidcFlow(authenticationService.getOidcUrl().getOrThrow())
} else if (it.supportsPasswordLogin) { } else if (matrixHomeServerDetails.supportsPasswordLogin) {
LoginFlow.PasswordLogin LoginFlow.PasswordLogin
} else { } else {
throw IllegalStateException("Unsupported login flow") throw IllegalStateException("Unsupported login flow")