Skip to content

Commit

Permalink
Merge pull request #171 from SecUSo/fix/filter-ignore-case
Browse files Browse the repository at this point in the history
Fix filter not ignoring case
  • Loading branch information
coderPaddyS authored Sep 17, 2024
2 parents 69d98ec + bc42940 commit 93c0847
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ class MainActivityViewModel(application: Application) : AndroidViewModel(applica
private fun Flow<List<Note>>.filterNotes(): Flow<List<Note>> {
return this.map {
it.filter { note ->
if (note.name.contains(filter.value)) {
if (note.name.contains(filter.value, ignoreCase = true)) {
return@filter true
}
when (note.type) {
DbContract.NoteEntry.TYPE_TEXT -> {
return@filter Html.fromHtml(note.content).toString().contains(filter.value)
return@filter Html.fromHtml(note.content).toString().contains(filter.value, ignoreCase = true)
}

DbContract.NoteEntry.TYPE_CHECKLIST -> {
return@filter ChecklistUtil.parse(note.content).joinToString(System.lineSeparator()).contains(filter.value)
return@filter ChecklistUtil.parse(note.content).joinToString(System.lineSeparator()).contains(filter.value, ignoreCase = true)
}

else -> return@filter false
Expand Down

0 comments on commit 93c0847

Please sign in to comment.