MCPcopy Create free account
hub / github.com/callstack/agent-device / handleSwipePresetCommand

Function handleSwipePresetCommand

src/core/dispatch-interactions.ts:579–604  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  interactor: Interactor,
  positionals: string[],
  context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

577}
578
579export async function handleSwipePresetCommand(
580 device: DeviceInfo,
581 interactor: Interactor,
582 positionals: string[],
583 context: DispatchContext | undefined,
584): Promise<Record<string, unknown>> {
585 const preset = parseSwipePreset(positionals[0]);
586 const requestedDurationMs = positionals[1] ? Number(positionals[1]) : 300;
587 const snapshot = await interactor.snapshot({ appBundleId: context?.appBundleId });
588 const frame = inferGestureReferenceFrame(snapshot.nodes ?? []);
589 if (!frame) {
590 throw new AppError('COMMAND_FAILED', 'Cannot infer viewport for gesture swipe preset');
591 }
592 const plan = buildSwipePresetGesturePlan(preset, frame, { platform: device.platform });
593 return await runSwipeCoordinates({
594 device,
595 interactor,
596 context,
597 x1: plan.x1,
598 y1: plan.y1,
599 x2: plan.x2,
600 y2: plan.y2,
601 requestedDurationMs,
602 preset,
603 });
604}
605
606// fallow-ignore-next-line complexity
607async function runSwipeCoordinates(params: {

Callers 2

dispatch.tsFile · 0.90

Calls 5

parseSwipePresetFunction · 0.90
runSwipeCoordinatesFunction · 0.85
snapshotMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…