Hide password field in incoming server settings when not needed
This commit is contained in:
parent
878cc45c04
commit
e80a02579a
3 changed files with 31 additions and 13 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package app.k9mail.feature.account.setup.ui.incoming
|
||||
|
||||
internal val AccountIncomingConfigContract.State.isPasswordFieldVisible: Boolean
|
||||
get() = authenticationType.isPasswordRequired
|
Loading…
Reference in a new issue