Skip to content

Commit

Permalink
review: Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Nov 13, 2024
1 parent 9036f90 commit 22bccb0
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ fun TransferDetailsScreen(
navigateBack: (() -> Unit)?,
transferDetailsViewModel: TransferDetailsViewModel = hiltViewModel<TransferDetailsViewModel>(),
) {

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
Expand All @@ -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 = {
Expand All @@ -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
Expand All @@ -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 },
)
}
}
Expand Down

0 comments on commit 22bccb0

Please sign in to comment.