From 8e9398e179a2e697dbd30f164ffd258028673eab Mon Sep 17 00:00:00 2001 From: Maciej Procyk Date: Sat, 18 Nov 2023 15:12:47 +0100 Subject: [PATCH] cleanup code --- .../ml/dev/kotlin/openotp/ui/component/ConfirmDialog.kt | 2 +- .../ml/dev/kotlin/openotp/ui/component/OtpCodeItems.kt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/ConfirmDialog.kt b/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/ConfirmDialog.kt index 11ed36e..96e6cc5 100644 --- a/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/ConfirmDialog.kt +++ b/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/ConfirmDialog.kt @@ -26,7 +26,7 @@ fun ConfirmDialog( dismissText: String = stringResource(OpenOtpResources.strings.cancel_button_name), confirmText: String = stringResource(OpenOtpResources.strings.proceed_button_name), ) { - Dialog(onDismissRequest = { onDismissRequest() }) { + Dialog(onDismissRequest = onDismissRequest) { Card( modifier = Modifier .wrapContentSize() diff --git a/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/OtpCodeItems.kt b/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/OtpCodeItems.kt index 55fd3f9..f0c0c4d 100644 --- a/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/OtpCodeItems.kt +++ b/shared/src/commonMain/kotlin/ml/dev/kotlin/openotp/ui/component/OtpCodeItems.kt @@ -100,9 +100,8 @@ internal fun OtpCodeItems( } ) } - when (val dismissed = dismissedCode) { - null -> Unit - else -> ConfirmDialog( + dismissedCode?.let { dismissed -> + ConfirmDialog( onDismissRequest = { dismissedCode = null }, onConfirmation = { dismissedCode = null