perf: empty apps when reboot (#619)

This commit is contained in:
lisonge 2024-05-13 13:48:18 +08:00
parent b1ae97f211
commit f1c34c11a9

View File

@ -26,7 +26,8 @@ class GlobalRule(
private val matchSystemApp = rule.matchSystemApp ?: group.matchSystemApp ?: false private val matchSystemApp = rule.matchSystemApp ?: group.matchSystemApp ?: false
val apps = mutableMapOf<String, GlobalApp>().apply { val apps = mutableMapOf<String, GlobalApp>().apply {
(rule.apps ?: group.apps ?: emptyList()).filter { a -> (rule.apps ?: group.apps ?: emptyList()).filter { a ->
appInfoCache.containsKey(a.id) // 过滤掉未安装应用 // https://github.com/gkd-kit/gkd/issues/619
appInfoCache.isEmpty() || appInfoCache.containsKey(a.id) // 过滤掉未安装应用
}.forEach { a -> }.forEach { a ->
val enable = a.enable ?: appInfoCache[a.id]?.let { appInfo -> val enable = a.enable ?: appInfoCache[a.id]?.let { appInfo ->
if (a.excludeVersionCodes?.contains(appInfo.versionCode) == true) { if (a.excludeVersionCodes?.contains(appInfo.versionCode) == true) {