Skip to content

Commit

Permalink
fix: skipConsumeEvent (gkd-kit#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge authored and wangxiaoyang08 committed Dec 20, 2024
1 parent f167607 commit 3ccb883
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ sealed class RuleStatus(val name: String) {

val ok: Boolean
get() = this === StatusOk

val alive: Boolean
get() = this !== Status1 && this !== Status2 && this !== Status4
}

fun getFixActivityIds(
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/service/A11yService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ private fun A11yService.useMatchRule() {
}
}
val activityRule = getAndUpdateCurrentRules()
if (evAppId != rightAppId || activityRule.skipMatch) {
// 放在 evAppId != rightAppId 的前面使得 TopActivity 能借助 lastTopActivity 恢复
// 放在 evAppId != rightAppId 的前面使得 TopActivity 能借助 lastTopActivity 恢复
if (evAppId != rightAppId || activityRule.skipConsumeEvent || !storeFlow.value.enableMatch) {
return@launchEvent
}

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/kotlin/li/songe/gkd/service/A11yState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ class ActivityRule(
}
val skipMatch: Boolean
get() {
return !currentRules.any { r -> r.status.ok } || !storeFlow.value.enableMatch
return currentRules.all { r -> !r.status.ok }
}
val skipConsumeEvent: Boolean
get() {
return currentRules.all { r -> !r.status.alive }
}
}

Expand Down

0 comments on commit 3ccb883

Please sign in to comment.