Skip to content

Commit

Permalink
fix: can not exclude page when manual enable app
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Mar 1, 2024
1 parent 0806d14 commit f98daef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/data/GlobalRule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/data/SubsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f98daef

Please sign in to comment.