fix(android): add an implementation for Exact filter mode
Will be eventually exposed to the UI
This commit is contained in:
parent
7475f2fb13
commit
f0d09584fb
1 changed files with 14 additions and 3 deletions
|
@ -94,18 +94,19 @@ val PasswordItem.stableId: String
|
||||||
enum class FilterMode {
|
enum class FilterMode {
|
||||||
NoFilter,
|
NoFilter,
|
||||||
StrictDomain,
|
StrictDomain,
|
||||||
Fuzzy
|
Fuzzy,
|
||||||
|
Exact,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class SearchMode {
|
enum class SearchMode {
|
||||||
RecursivelyInSubdirectories,
|
RecursivelyInSubdirectories,
|
||||||
InCurrentDirectoryOnly
|
InCurrentDirectoryOnly,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ListMode {
|
enum class ListMode {
|
||||||
FilesOnly,
|
FilesOnly,
|
||||||
DirectoriesOnly,
|
DirectoriesOnly,
|
||||||
AllEntries
|
AllEntries,
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
|
@ -219,6 +220,16 @@ constructor(
|
||||||
.toList()
|
.toList()
|
||||||
.sortedWith(itemComparator)
|
.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 -> {
|
FilterMode.StrictDomain -> {
|
||||||
check(searchAction.listMode == ListMode.FilesOnly) {
|
check(searchAction.listMode == ListMode.FilesOnly) {
|
||||||
"Searches with StrictDomain search mode can only list files"
|
"Searches with StrictDomain search mode can only list files"
|
||||||
|
|
Loading…
Reference in a new issue