fix: can not exclude page when manual enable app

This commit is contained in:
lisonge 2024-03-01 18:00:23 +08:00
parent 0806d14616
commit f98daefbd0
2 changed files with 6 additions and 4 deletions

View File

@ -62,12 +62,14 @@ class GlobalRule(
if (excludeData.excludeAppIds.contains(appId)) {
return false
}
if (activityId != null && excludeData.activityIds.contains(appId to activityId)) {
return false
}
if (excludeData.includeAppIds.contains(appId)) {
activityId ?: return true
val app = apps[appId] ?: return true
// 规则自带页面的禁用
return !app.excludeActivityIds.any { e -> e.startsWith(activityId) }
} else if (activityId != null && excludeData.activityIds.contains(appId to activityId)) {
return false
}
if (!matchLauncher && appId == launcherAppId) {
return false

View File

@ -85,8 +85,8 @@ data class ExcludeData(
val appIds: Map<String, Boolean>,
val activityIds: Set<Pair<String, String>>,
) {
val excludeAppIds = appIds.entries.filter { e -> e.value }.map { e -> e.key }.toSet()
val includeAppIds = appIds.entries.filter { e -> !e.value }.map { e -> e.key }.toSet()
val excludeAppIds = appIds.entries.filter { e -> e.value }.map { e -> e.key }.toHashSet()
val includeAppIds = appIds.entries.filter { e -> !e.value }.map { e -> e.key }.toHashSet()
companion object {
fun parse(exclude: String?): ExcludeData {