( device: DeviceInfo, interactor: Interactor, positionals: string[], context: DispatchContext | undefined, )
| 577 | } |
| 578 | |
| 579 | export 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 |
| 607 | async function runSwipeCoordinates(params: { |
no test coverage detected
searching dependent graphs…