mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(driver): native DoubleTap RPC for a tight inter-tap gap
Composing two Tap round trips from the Go client spread the taps by hundreds of milliseconds on iOS, wide enough for the app to navigate between them, so double-submission races could never reproduce. The sidecar now lands both taps back-to-back next to the device transport.
This commit is contained in:
1 parent
d6188df667
commit
4f579d2a0b
8 files changed
+151
-38
No files matched your search
@@ -104,14 +104,18 @@ func (c *Client) TapSelector(ctx context.Context, selector string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// doubleTapGap is the inter-tap delay for DoubleTap: short enough to land both
|
||||
// events inside a sub-100 ms race window, long enough for the sidecar to
|
||||
// serialize two MotionEvent streams. The sidecar exposes no native double-tap
|
||||
// RPC, so the gesture is two Taps with this gap.
|
||||
// doubleTapGap is the inter-tap delay for the selector fallback: short enough
|
||||
// to land both events inside a sub-100 ms race window, long enough for the
|
||||
// sidecar to serialize two MotionEvent streams.
|
||||
const doubleTapGap = 50 * time.Millisecond
|
||||
|
||||
// DoubleTap dispatches the native RPC so the backend can land both taps as
|
||||
// close together as the platform allows. Composing two Tap round trips from
|
||||
// here spreads them by hundreds of milliseconds on iOS, wide enough for
|
||||
// navigation to interleave between the taps.
|
||||
func (c *Client) DoubleTap(ctx context.Context, x, y int) error {
|
||||
return doubleTap(ctx, func() error { return c.Tap(ctx, x, y) })
|
||||
_, err := c.stub.DoubleTap(ctx, &driverpb.Point{X: int32(x), Y: int32(y)})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) DoubleTapSelector(ctx context.Context, selector string) error {
|
||||
|
||||
Reference in new issue
Block a user