Skip to content

Commit aac89c0

Browse files
Merge pull request #362 from MihaiCristianCondrea/codex/remove-from-previewtype.text-branch
Refactor text preview snippet handling
2 parents 5354896 + 131af66 commit aac89c0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

app/src/main/kotlin/com/d4rk/cleaner/app/clean/scanner/utils/helpers/FilePreviewHelper.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -507,21 +507,19 @@ object FilePreviewHelper {
507507
val snippet by produceState<String?>(initialValue = null, file.path) {
508508
value = loadTextSnippet(file)
509509
}
510-
if (snippet != null) {
510+
snippet?.let {
511511
Text(
512-
text = snippet!!,
512+
text = it,
513513
style = MaterialTheme.typography.labelSmall,
514514
maxLines = 3,
515515
overflow = TextOverflow.Ellipsis,
516516
modifier = modifier
517517
)
518-
} else {
519-
Icon(
520-
painter = painterResource(id = R.drawable.ic_unknown_document),
521-
contentDescription = null,
522-
modifier = modifier.size(24.dp)
523-
)
524-
}
518+
} ?: Icon(
519+
painter = painterResource(id = R.drawable.ic_unknown_document),
520+
contentDescription = null,
521+
modifier = modifier.size(24.dp)
522+
)
525523
}
526524

527525
PreviewType.Archive -> {

0 commit comments

Comments
 (0)