File tree Expand file tree Collapse file tree 2 files changed +3
-21
lines changed
app/src/main/java/com/yogeshpaliyal/keypass/ui/nav
common/src/main/java/com/yogeshpaliyal/common/db Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -33,30 +33,12 @@ class BottomNavViewModel @Inject constructor(
33
33
34
34
viewModelScope.launch {
35
35
tagsDb.collect {
36
- tagsList = it
36
+ tagsList = it.flatMap { it.split( " , " ) }.map { it.trim() }.toSet().toList()
37
37
postListUpdate()
38
38
}
39
39
}
40
40
}
41
41
42
- /* *
43
- * Set the currently selected menu item.
44
- *
45
- * @return true if the currently selected item has changed.
46
- */
47
- fun setNavigationMenuItemChecked (id : Int ): Boolean {
48
- var updated = false
49
- NavigationModel .navigationMenuItems.forEachIndexed { index, item ->
50
- val shouldCheck = item.id == id
51
- if (item.checked != shouldCheck) {
52
- NavigationModel .navigationMenuItems[index] = item.copy(checked = shouldCheck)
53
- updated = true
54
- }
55
- }
56
- if (updated) postListUpdate()
57
- return updated
58
- }
59
-
60
42
private fun postListUpdate () {
61
43
val newList = if (tagsList.isNullOrEmpty().not ()) {
62
44
NavigationModel .navigationMenuItems + NavigationModelItem .NavDivider (" Tags" ) + (
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ interface DbDao {
35
35
" SELECT * FROM account " +
36
36
" WHERE " +
37
37
" CASE WHEN :tag IS NOT NULL " +
38
- " THEN tags = :tag " +
38
+ " THEN ( tags LIKE '%'|| :tag||'%' ) " +
39
39
" ELSE 1 END " +
40
40
" AND ((username LIKE '%'||:query||'%' ) " +
41
41
" OR (title LIKE '%'||:query||'%' ) " +
@@ -57,7 +57,7 @@ interface DbDao {
57
57
" SELECT * FROM account " +
58
58
" WHERE " +
59
59
" CASE WHEN :tag IS NOT NULL " +
60
- " THEN tags = :tag " +
60
+ " THEN ( tags LIKE '%'|| :tag||'%' ) " +
61
61
" ELSE 1 END " +
62
62
" AND ((username LIKE '%'||:query||'%' ) " +
63
63
" OR (title LIKE '%'||:query||'%' ) " +
You can’t perform that action at this time.
0 commit comments