Prevent Git files from turning up in search and listing (#1582)
* Prevent Git files from turning up in search and listing * Update changelog
This commit is contained in:
parent
17f640bf46
commit
933558caf8
2 changed files with 6 additions and 3 deletions
|
@ -34,6 +34,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Changing password generator parameters now automatically updates the password without needing to press the 'Generate' button again
|
- Changing password generator parameters now automatically updates the password without needing to press the 'Generate' button again
|
||||||
- The app UI was reskinned to match Google's Material You guidelines
|
- The app UI was reskinned to match Google's Material You guidelines
|
||||||
- Using HTTPS without authentication is now fully supported, and no longer asks for a username
|
- Using HTTPS without authentication is now fully supported, and no longer asks for a username
|
||||||
|
- Enabling 'Show hidden files and folders' no longer shows Git-related files and folders
|
||||||
|
|
||||||
## [1.13.5] - 2021-07-28
|
## [1.13.5] - 2021-07-28
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,9 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
|
||||||
|
|
||||||
private fun shouldTake(file: File) =
|
private fun shouldTake(file: File) =
|
||||||
with(file) {
|
with(file) {
|
||||||
if (showHiddenContents) return true
|
if (showHiddenContents) {
|
||||||
|
return !file.name.startsWith(".git")
|
||||||
|
}
|
||||||
if (isDirectory) {
|
if (isDirectory) {
|
||||||
!isHidden
|
!isHidden
|
||||||
} else {
|
} else {
|
||||||
|
@ -251,7 +253,7 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun listFiles(dir: File): Flow<File> {
|
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> {
|
private fun listFilesRecursively(dir: File): Flow<File> {
|
||||||
|
@ -266,7 +268,7 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
|
||||||
yield()
|
yield()
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
.filter { file -> shouldTake(file) }
|
.filter(::shouldTake)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val _currentDir = MutableLiveData(root)
|
private val _currentDir = MutableLiveData(root)
|
||||||
|
|
Loading…
Reference in a new issue