mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
fix(runner): apply-time guard consults focused window, not just resumed activity
ensureForeground detects a system overlay (notification shade) owning the focused window while the app stays the resumed activity, but appIsForeground only queried ForegroundApp. A swipe that pulls the shade over the app between observe and apply then fired onto the shade. Mirror the focus check at apply time so the action skips and the next step dismisses the overlay.
This commit is contained in:
1 parent
72a0c1c26e
commit
663f9e7180
1 file changed
+16
-1
@@ -437,7 +437,22 @@ func appIsForeground(ctx context.Context, options Options) bool {
|
|||||||
if err != nil || foreground == "" {
|
if err != nil || foreground == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return foreground == options.BundleID
|
if foreground != options.BundleID {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// The app is the resumed activity, but a system overlay (the notification
|
||||||
|
// shade) can own the focused window while the app stays resumed; firing the
|
||||||
|
// action would land on the overlay. Mirror ensureForeground's focus check
|
||||||
|
// here so the apply-time guard skips and the next step dismisses it.
|
||||||
|
focusChecker, ok := options.Driver.(driver.FocusedWindowChecker)
|
||||||
|
if !ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
focused, err := focusChecker.FocusedWindowApp(ctx)
|
||||||
|
if err != nil || focused == "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return focused == options.BundleID
|
||||||
}
|
}
|
||||||
|
|
||||||
// foregroundReadyAttempts bounds how many times waitForForeground tries to
|
// foregroundReadyAttempts bounds how many times waitForForeground tries to
|
||||||
|
|||||||
Reference in new issue
Block a user