Skip to content

Commit 45f2ed7

Browse files
authored
Merge pull request #2398 from switchifyapp/fix/absorb-switch-on-task-stop-2397
Absorb switch key events when stopping ongoing tasks
2 parents faf446f + f4382aa commit 45f2ed7

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

app/src/main/java/com/enaboapps/switchify/service/switches/external/ExternalSwitchListener.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ class ExternalSwitchListener(
5858

5959
val scanningManager = ServiceCore.getScanningManager()
6060
if (scanningManager != null) {
61-
if (scanningManager.checkOngoingTasks()) return false
61+
if (scanningManager.checkOngoingTasks()) {
62+
// The press was consumed by stopping/advancing an ongoing task
63+
// (e.g. auto scroll). Clear the latest action so the matching
64+
// release is swallowed without firing a stale press action, and
65+
// absorb the key event so it does not leak to the foreground app.
66+
latestAction = null
67+
return true
68+
}
6269
}
6370

6471
val pauseManager = ServiceCore.getPauseManager()

0 commit comments

Comments
 (0)