Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix(android): add an implementation for Exact filter mode
Browse files Browse the repository at this point in the history
Will be eventually exposed to the UI
  • Loading branch information
msfjarvis committed Nov 30, 2023
1 parent 7475f2f commit f0d0958
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f0d0958

Please sign in to comment.