Hide password field in incoming server settings when not needed

This commit is contained in:
cketti 2023-07-03 16:58:39 +02:00
parent 878cc45c04
commit e80a02579a
3 changed files with 31 additions and 13 deletions

View file

@ -2,12 +2,24 @@ package app.k9mail.feature.account.setup.domain.entity
import kotlinx.collections.immutable.toImmutableList
enum class AuthenticationType {
None,
PasswordCleartext,
PasswordEncrypted,
ClientCertificate,
OAuth2,
enum class AuthenticationType(
val isPasswordRequired: Boolean,
) {
None(
isPasswordRequired = false,
),
PasswordCleartext(
isPasswordRequired = true,
),
PasswordEncrypted(
isPasswordRequired = true,
),
ClientCertificate(
isPasswordRequired = false,
),
OAuth2(
isPasswordRequired = false,
),
;
companion object {

View file

@ -155,13 +155,15 @@ internal fun AccountIncomingConfigContent(
)
}
item {
PasswordInput(
password = state.password.value,
errorMessage = state.password.error?.toResourceString(resources),
onPasswordChange = { onEvent(Event.PasswordChanged(it)) },
contentPadding = defaultItemPadding(),
)
if (state.isPasswordFieldVisible) {
item {
PasswordInput(
password = state.password.value,
errorMessage = state.password.error?.toResourceString(resources),
onPasswordChange = { onEvent(Event.PasswordChanged(it)) },
contentPadding = defaultItemPadding(),
)
}
}
item {

View file

@ -0,0 +1,4 @@
package app.k9mail.feature.account.setup.ui.incoming
internal val AccountIncomingConfigContract.State.isPasswordFieldVisible: Boolean
get() = authenticationType.isPasswordRequired