summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-12-09 08:11:44 +0530
committerGitHub <noreply@github.com>2021-12-09 02:41:44 +0000
commit933558caf8266677dc26497d7c7b930254f4fb07 (patch)
tree3d671ec175bb6b27605096c213f542614f67038e /app/src/main
parent17f640bf468383c791bd4f8e7934e84d9d262079 (diff)
Prevent Git files from turning up in search and listing (#1582)
* Prevent Git files from turning up in search and listing * Update changelog
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/viewmodel/SearchableRepositoryViewModel.kt8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/viewmodel/SearchableRepositoryViewModel.kt b/app/src/main/java/dev/msfjarvis/aps/util/viewmodel/SearchableRepositoryViewModel.kt
index 1c1b6aee..a8af961a 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/viewmodel/SearchableRepositoryViewModel.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/viewmodel/SearchableRepositoryViewModel.kt
@@ -242,7 +242,9 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
private fun shouldTake(file: File) =
with(file) {
- if (showHiddenContents) return true
+ if (showHiddenContents) {
+ return !file.name.startsWith(".git")
+ }
if (isDirectory) {
!isHidden
} else {
@@ -251,7 +253,7 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
}
private fun listFiles(dir: File): Flow<File> {
- return dir.listFiles { file -> shouldTake(file) }?.asFlow() ?: emptyFlow()
+ return dir.listFiles(::shouldTake)?.asFlow() ?: emptyFlow()
}
private fun listFilesRecursively(dir: File): Flow<File> {
@@ -266,7 +268,7 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
yield()
it
}
- .filter { file -> shouldTake(file) }
+ .filter(::shouldTake)
}
private val _currentDir = MutableLiveData(root)