From 22bccb06ddf285920893929ecf77f2607c66e5da Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Wed, 13 Nov 2024 14:31:44 +0100 Subject: [PATCH] review: Apply suggestions from code review --- .../transferdetails/TransferDetailsScreen.kt | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt index 6257189a2..4855c01cd 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt @@ -62,14 +62,16 @@ fun TransferDetailsScreen( navigateBack: (() -> Unit)?, transferDetailsViewModel: TransferDetailsViewModel = hiltViewModel(), ) { - - val getCheckedFiles = { transferDetailsViewModel.checkedFiles } - val clearCheckedFiles = { transferDetailsViewModel.checkedFiles.clear() } - val setFileCheckStatus: (String, Boolean) -> Unit = { fileUid, isChecked -> - transferDetailsViewModel.checkedFiles[fileUid] = isChecked - } - - TransferDetailsScreen(transferUuid, direction, navigateBack, getCheckedFiles, clearCheckedFiles, setFileCheckStatus) + TransferDetailsScreen( + transferUuid = transferUuid, + direction = direction, + navigateBack = navigateBack, + getCheckedFiles = { transferDetailsViewModel.checkedFiles }, + clearCheckedFiles = { transferDetailsViewModel.checkedFiles.clear() }, + setFileCheckStatus = { fileUid, isChecked -> + transferDetailsViewModel.checkedFiles[fileUid] = isChecked + }, + ) } @Composable @@ -90,8 +92,8 @@ private fun TransferDetailsScreen( val transferPassword = "toto42" // TODO: Use real data var isMultiselectOn: Boolean by rememberSaveable { mutableStateOf(false) } - var isQrCodeVisible: Boolean by rememberSaveable { mutableStateOf(false) } - var isPasswordVisible: Boolean by rememberSaveable { mutableStateOf(false) } + var showQrCodeSheet: Boolean by rememberSaveable { mutableStateOf(false) } + var showPasswordSheet: Boolean by rememberSaveable { mutableStateOf(false) } SmallWindowTopAppBarScaffold( smallWindowTopAppBar = { @@ -113,8 +115,8 @@ private fun TransferDetailsScreen( onClick = { item -> when (item) { BottomBarItem.SHARE -> context.shareText(transferUrl) - BottomBarItem.QR_CODE -> isQrCodeVisible = true - BottomBarItem.PASSWORD -> isPasswordVisible = true + BottomBarItem.QR_CODE -> showQrCodeSheet = true + BottomBarItem.PASSWORD -> showPasswordSheet = true BottomBarItem.DOWNLOAD -> { // TODO: Move the multiselect elsewhere, and implement this feature isMultiselectOn = true @@ -130,14 +132,14 @@ private fun TransferDetailsScreen( } QrCodeBottomSheet( - isVisible = { isQrCodeVisible }, + isVisible = { showQrCodeSheet }, transferUrl = transferUrl, - closeBottomSheet = { isQrCodeVisible = false }, + closeBottomSheet = { showQrCodeSheet = false }, ) PasswordBottomSheet( - isVisible = { isPasswordVisible }, + isVisible = { showPasswordSheet }, transferPassword = transferPassword, - closeBottomSheet = { isPasswordVisible = false }, + closeBottomSheet = { showPasswordSheet = false }, ) } }