Skip to content

Commit

Permalink
fix(ImportScreen): Fix preview
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Oct 23, 2024
1 parent fa1cef8 commit 490819d
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ fun ImportFilesScreen(
closeActivity: () -> Unit,
) {
val files by newTransferViewModel.files.collectAsStateWithLifecycle()
ImportFilesScreen({ files }, newTransferViewModel::removeFileByUid, newTransferViewModel::addFiles, closeActivity)
ImportFilesScreen(
files = { files },
removeFileByUid = newTransferViewModel::removeFileByUid,
addFiles = newTransferViewModel::addFiles,
closeActivity = closeActivity,
initialShowUploadSourceChoiceBottomSheet = true,
)
}

@Composable
Expand All @@ -55,9 +61,10 @@ private fun ImportFilesScreen(
removeFileByUid: (uid: String) -> Unit,
addFiles: (List<Uri>) -> Unit,
closeActivity: () -> Unit,
initialShowUploadSourceChoiceBottomSheet: Boolean,
) {
val context = LocalContext.current
var showUploadSourceChoiceBottomSheet by rememberSaveable { mutableStateOf(true) }
var showUploadSourceChoiceBottomSheet by rememberSaveable { mutableStateOf(initialShowUploadSourceChoiceBottomSheet) }

val importedFiles = files()
val humanReadableSize = remember(importedFiles) {
Expand Down Expand Up @@ -113,6 +120,12 @@ private fun ImportFilesScreen(
@Composable
private fun ImportFilesScreenPreview(@PreviewParameter(FileUiListPreviewParameter::class) files: List<FileUi>) {
SwissTransferTheme {
ImportFilesScreen({ files }, {}, {}, closeActivity = {})
ImportFilesScreen(
files = { files },
removeFileByUid = {},
addFiles = {},
closeActivity = {},
initialShowUploadSourceChoiceBottomSheet = false,
)
}
}

0 comments on commit 490819d

Please sign in to comment.