MCPcopy Index your code
hub / github.com/callstack/agent-device / buildSwipeSequenceSteps

Function buildSwipeSequenceSteps

src/core/dispatch-interactions.ts:447–474  ·  view source on GitHub ↗
(params: {
  device: DeviceInfo;
  x1: number;
  y1: number;
  x2: number;
  y2: number;
  count: number;
  pauseMs: number;
  pattern: string;
  effectiveDurationMs: number;
})

Source from the content-addressed store, hash-verified

445// runner-side performDragSeries the daemon no longer invokes. iOS touch targets request the same
446// synthesized, duration-aware drag path as one-shot swipe; macOS/tvOS keep coordinate drag.
447function buildSwipeSequenceSteps(params: {
448 device: DeviceInfo;
449 x1: number;
450 y1: number;
451 x2: number;
452 y2: number;
453 count: number;
454 pauseMs: number;
455 pattern: string;
456 effectiveDurationMs: number;
457}): RunnerSequenceStep[] {
458 const { device, x1, y1, x2, y2, count, pauseMs, pattern, effectiveDurationMs } = params;
459 const synthesized = isIosFamily(device) && !isTvOsDevice(device);
460 return Array.from({ length: count }, (_, index) => {
461 const reverse = pattern === 'ping-pong' && index % 2 === 1;
462 const isLast = index === count - 1;
463 return {
464 kind: 'drag' as const,
465 x: reverse ? x2 : x1,
466 y: reverse ? y2 : y1,
467 x2: reverse ? x1 : x2,
468 y2: reverse ? y1 : y2,
469 durationMs: effectiveDurationMs,
470 ...(synthesized ? { synthesized: true } : {}),
471 ...(!isLast && pauseMs > 0 ? { pauseMs } : {}),
472 };
473 });
474}
475
476// Sequence step errors carry a chunk-local failedStepIndex and completedSteps; rebase both onto the
477// global series so the error names the true step and completed count across chunk boundaries.

Callers 1

runSwipeCoordinatesFunction · 0.85

Calls 2

isIosFamilyFunction · 0.90
isTvOsDeviceFunction · 0.90

Tested by

no test coverage detected