Navigate directly to generator when edited item's password or username fields are empty (#785)

This commit is contained in:
Joshua Queen
2024-01-25 14:25:01 -05:00
committed by Álison Fernandes
parent 465cce42f0
commit 2f2f5703a7
2 changed files with 71 additions and 4 deletions

View File

@@ -346,7 +346,13 @@ private fun UsernameRow(
iconPainter = painterResource(id = R.drawable.ic_generator),
contentDescription = stringResource(id = R.string.generate_username),
),
onClick = { shouldShowDialog = true },
onClick = {
if (loginState.username.isEmpty()) {
loginItemTypeHandlers.onOpenUsernameGeneratorClick()
} else {
shouldShowDialog = true
}
},
)
},
modifier = Modifier.padding(horizontal = 16.dp),
@@ -375,6 +381,7 @@ private fun UsernameRow(
}
}
@Suppress("LongMethod")
@Composable
private fun PasswordRow(
loginState: VaultAddEditState.ViewState.Content.ItemType.Login,
@@ -403,7 +410,13 @@ private fun PasswordRow(
iconPainter = painterResource(id = R.drawable.ic_generator),
contentDescription = stringResource(id = R.string.generate_password),
),
onClick = { shouldShowDialog = true },
onClick = {
if (loginState.password.isEmpty()) {
loginItemTypeHandlers.onOpenPasswordGeneratorClick()
} else {
shouldShowDialog = true
}
},
)
if (shouldShowDialog) {