-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7345 from thunderbird/add_biometric_password_inpu…
…t_to_server_settings Add biometric password input to server settings form
- Loading branch information
Showing
5 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...otlin/app/k9mail/feature/account/server/settings/ui/common/ServerSettingsPasswordInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package app.k9mail.feature.account.server.settings.ui.common | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import app.k9mail.core.ui.compose.designsystem.molecule.input.PasswordInput | ||
import app.k9mail.core.ui.compose.designsystem.molecule.input.inputContentPadding | ||
import app.k9mail.core.ui.compose.theme.PreviewWithThemes | ||
import app.k9mail.feature.account.common.domain.entity.InteractionMode | ||
|
||
@Composable | ||
fun ServerSettingsPasswordInput( | ||
mode: InteractionMode, | ||
onPasswordChange: (String) -> Unit, | ||
modifier: Modifier = Modifier, | ||
password: String = "", | ||
isRequired: Boolean = false, | ||
errorMessage: String? = null, | ||
contentPadding: PaddingValues = inputContentPadding(), | ||
) { | ||
if (mode == InteractionMode.Create) { | ||
PasswordInput( | ||
onPasswordChange = onPasswordChange, | ||
modifier = modifier, | ||
password = password, | ||
isRequired = isRequired, | ||
errorMessage = errorMessage, | ||
contentPadding = contentPadding, | ||
) | ||
} else { | ||
BiometricPasswordInput( | ||
onPasswordChange = onPasswordChange, | ||
modifier = modifier, | ||
password = password, | ||
isRequired = isRequired, | ||
errorMessage = errorMessage, | ||
contentPadding = contentPadding, | ||
) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
internal fun ServerSettingsPasswordInputCreatePreview() { | ||
PreviewWithThemes { | ||
ServerSettingsPasswordInput( | ||
mode = InteractionMode.Create, | ||
onPasswordChange = {}, | ||
) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
internal fun ServerSettingsPasswordInputEditPreview() { | ||
PreviewWithThemes { | ||
ServerSettingsPasswordInput( | ||
mode = InteractionMode.Edit, | ||
onPasswordChange = {}, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters