fix(android): add an implementation for Exact filter mode

Will be eventually exposed to the UI
This commit is contained in:
Harsh Shandilya 2023-11-30 15:51:16 +05:30
parent 7475f2fb13
commit f0d09584fb
No known key found for this signature in database

View file

@ -94,18 +94,19 @@ val PasswordItem.stableId: String
enum class FilterMode {
NoFilter,
StrictDomain,
Fuzzy
Fuzzy,
Exact,
}
enum class SearchMode {
RecursivelyInSubdirectories,
InCurrentDirectoryOnly
InCurrentDirectoryOnly,
}
enum class ListMode {
FilesOnly,
DirectoriesOnly,
AllEntries
AllEntries,
}
@OptIn(ExperimentalCoroutinesApi::class)
@ -219,6 +220,16 @@ constructor(
.toList()
.sortedWith(itemComparator)
}
FilterMode.Exact -> {
prefilteredResultFlow
.filter { absoluteFile ->
absoluteFile.relativeTo(root).path.contains(searchAction.filter)
}
.map { it.toPasswordItem() }
.flowOn(dispatcherProvider.io())
.toList()
.sortedWith(itemComparator)
}
FilterMode.StrictDomain -> {
check(searchAction.listMode == ListMode.FilesOnly) {
"Searches with StrictDomain search mode can only list files"