diff --git a/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludeVm.kt b/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludeVm.kt index 2ac5f63..e7129ea 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludeVm.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludeVm.kt @@ -77,7 +77,12 @@ class GlobalRuleExcludeVm @Inject constructor(stateHandle: SavedStateHandle) : V if (str.isBlank()) { apps } else { - (apps.filter { a -> a.name.contains(str) } + apps.filter { a -> a.id.contains(str) }).distinct() + (apps.filter { a -> a.name.contains(str, true) } + apps.filter { a -> + a.id.contains( + str, + true + ) + }).distinct() } }.stateIn(viewModelScope, SharingStarted.Eagerly, emptyList()) diff --git a/app/src/main/kotlin/li/songe/gkd/ui/home/HomeVm.kt b/app/src/main/kotlin/li/songe/gkd/ui/home/HomeVm.kt index be1d948..8661e10 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/home/HomeVm.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/home/HomeVm.kt @@ -202,13 +202,14 @@ class HomeVm @Inject constructor() : ViewModel() { appInfos } } - }.combine(debounceSearchStrFlow) { appInfos, debounceSearchStr -> - if (debounceSearchStr.isBlank()) { + }.combine(debounceSearchStrFlow) { appInfos, str -> + if (str.isBlank()) { appInfos } else { - (appInfos.filter { a -> a.name.contains(debounceSearchStr) } + appInfos.filter { a -> + (appInfos.filter { a -> a.name.contains(str, true) } + appInfos.filter { a -> a.id.contains( - debounceSearchStr + str, + true ) }).distinct() }