OIDC configuration (#4623)
* Login: more logs. * Login: map Oidc error to provide more information in the error dialog. * Oidc: use the application name. * Oidc: move configuration from OidcConfigurationProvider to OidcConfig and add some comments. * Oidc: limit to only 1 contact in the configuration. * Oidc: Move configuration to BuildConfig file. * Remove unused const. * Add missing test on Exception mapping * Remove contacts from OidcConfiguration. https://github.com/matrix-org/matrix-rust-sdk/pull/4958
This commit is contained in:
@@ -12,18 +12,24 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import io.element.android.features.login.impl.R
|
||||
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
sealed class ChangeServerError : Throwable() {
|
||||
data class Error(@StringRes val messageId: Int) : ChangeServerError() {
|
||||
data class Error(
|
||||
@StringRes val messageId: Int? = null,
|
||||
val messageStr: String? = null,
|
||||
) : ChangeServerError() {
|
||||
@Composable
|
||||
fun message(): String = stringResource(messageId)
|
||||
fun message(): String = messageStr ?: stringResource(messageId ?: CommonStrings.error_unknown)
|
||||
}
|
||||
|
||||
data object SlidingSyncAlert : ChangeServerError()
|
||||
|
||||
companion object {
|
||||
fun from(error: Throwable): ChangeServerError = when (error) {
|
||||
is AuthenticationException.SlidingSyncVersion -> SlidingSyncAlert
|
||||
else -> Error(R.string.screen_change_server_error_invalid_homeserver)
|
||||
is AuthenticationException.Oidc -> Error(messageStr = error.message)
|
||||
else -> Error(messageId = R.string.screen_change_server_error_invalid_homeserver)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user