Skip to content

Commit

Permalink
chore: Remove unnecessary nullable return
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Nov 28, 2024
1 parent 7d5fc95 commit ca19518
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ImportFilesViewModel @Inject constructor(
}
}

fun getFiles(folderUuid: String?): Flow<List<FileUi>?> {
fun getFiles(folderUuid: String?): Flow<List<FileUi>> {
return if (folderUuid == null) {
importationFilesManager.importedFiles
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,16 @@ fun FilesDetailsScreen(
navigateBack: (() -> Unit),
) {
// If we don't have a folderUuid, it means we have to load files from importedFiles in ImportFilesViewModel
val files by importFilesViewModel.getFiles(folderUuid).collectAsStateWithLifecycle(null)
val files by importFilesViewModel.getFiles(folderUuid).collectAsStateWithLifecycle(emptyList())

if (files?.isEmpty() == true) navigateBack()
if (files.isEmpty() == true) navigateBack()

FilesDetailsScreen(
files = files ?: emptyList(),
files = files,
navigateToDetails = navigateToDetails,
withFileSize = withFileSize,
withSpaceLeft = withSpaceLeft,
onFileRemoved = if (withFileDelete) {
{ importFilesViewModel.removeFileByUid(it) }
} else null,
onFileRemoved = getOnFileRemoveCallback(withFileDelete, importFilesViewModel),
onCloseClicked = onCloseClicked,
navigateBack = navigateBack,
)
Expand Down

0 comments on commit ca19518

Please sign in to comment.