Skip to content

Commit

Permalink
refactor: Rename shouldEnableConfirmButton with `isConfirmButtonEna…
Browse files Browse the repository at this point in the history
…bled`
  • Loading branch information
FabianDevel committed Dec 3, 2024
1 parent a15b681 commit c78ac8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fun SwissTransferAlertDialog(
@StringRes descriptionRes: Int,
onDismiss: () -> Unit,
onConfirmation: () -> Unit,
shouldEnableConfirmButton: () -> Boolean = { true },
isConfirmButtonEnabled: () -> Boolean = { true },
content: @Composable (ColumnScope.() -> Unit)? = null,
) {
BasicAlertDialog(
Expand All @@ -56,7 +56,7 @@ fun SwissTransferAlertDialog(
additionalContent = content,
onDismiss = onDismiss,
onConfirmation = onConfirmation,
shouldEnableConfirmButton = shouldEnableConfirmButton,
isConfirmButtonEnabled = isConfirmButtonEnabled,
)
}
}
Expand All @@ -70,7 +70,7 @@ private fun BasicAlertDialogContent(
additionalContent: @Composable (ColumnScope.() -> Unit)? = null,
onDismiss: () -> Unit,
onConfirmation: () -> Unit,
shouldEnableConfirmButton: () -> Boolean = { true },
isConfirmButtonEnabled: () -> Boolean = { true },
) {
Column(modifier.padding(Margin.Large)) {
TitleAndDescription(titleRes, descriptionRes)
Expand All @@ -79,7 +79,7 @@ private fun BasicAlertDialogContent(
it()
Spacer(Modifier.height(Margin.Mini))
}
ActionButtons(onDismiss, onConfirmation, shouldEnableConfirmButton)
ActionButtons(onDismiss, onConfirmation, isConfirmButtonEnabled)
}
}

Expand All @@ -99,7 +99,7 @@ private fun TitleAndDescription(titleRes: Int, descriptionRes: Int) {
}

@Composable
private fun ActionButtons(onDismissRequest: () -> Unit, onConfirmation: () -> Unit, shouldEnable: () -> Boolean) {
private fun ActionButtons(onDismissRequest: () -> Unit, onConfirmation: () -> Unit, isEnabled: () -> Boolean) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
Expand All @@ -114,7 +114,7 @@ private fun ActionButtons(onDismissRequest: () -> Unit, onConfirmation: () -> Un
SmallButton(
titleRes = R.string.buttonConfirm,
onClick = onConfirmation,
enabled = shouldEnable
enabled = isEnabled
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fun PasswordOptionAlertDialog(
descriptionRes = R.string.settingsPasswordDescription,
onDismiss = ::onDismiss,
onConfirmation = ::onConfirmButtonClicked,
shouldEnableConfirmButton = { !isPasswordActivated || isPasswordValid() },
isConfirmButtonEnabled = { !isPasswordActivated || isPasswordValid() },
) {
ActivatePasswordSwitch(isChecked = isPasswordActivated, onCheckedChange = { isPasswordActivated = it })
Spacer(Modifier.height(Margin.Medium))
Expand Down

0 comments on commit c78ac8b

Please sign in to comment.