Skip to content

Commit be313f5

Browse files
committed
fix: skipConsumeEvent (gkd-kit#824)
1 parent a0b280d commit be313f5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ sealed class RuleStatus(val name: String) {
205205

206206
val ok: Boolean
207207
get() = this === StatusOk
208+
209+
val alive: Boolean
210+
get() = this !== Status1 && this !== Status2 && this !== Status4
208211
}
209212

210213
fun getFixActivityIds(

app/src/main/kotlin/li/songe/gkd/service/A11yService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ private fun A11yService.useMatchRule() {
455455
}
456456
}
457457
val activityRule = getAndUpdateCurrentRules()
458-
if (evAppId != rightAppId || activityRule.skipMatch) {
459-
// 放在 evAppId != rightAppId 的前面使得 TopActivity 能借助 lastTopActivity 恢复
458+
// 放在 evAppId != rightAppId 的前面使得 TopActivity 能借助 lastTopActivity 恢复
459+
if (evAppId != rightAppId || activityRule.skipConsumeEvent || !storeFlow.value.enableMatch) {
460460
return@launchEvent
461461
}
462462

app/src/main/kotlin/li/songe/gkd/service/A11yState.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ class ActivityRule(
9797
}
9898
val skipMatch: Boolean
9999
get() {
100-
return !currentRules.any { r -> r.status.ok } || !storeFlow.value.enableMatch
100+
return currentRules.all { r -> !r.status.ok }
101+
}
102+
val skipConsumeEvent: Boolean
103+
get() {
104+
return currentRules.all { r -> !r.status.alive }
101105
}
102106
}
103107

0 commit comments

Comments
 (0)