( device: DeviceInfo, interactor: Interactor, positionals: string[], context: DispatchContext | undefined, )
| 550 | } |
| 551 | |
| 552 | export async function handleSwipeCommand( |
| 553 | device: DeviceInfo, |
| 554 | interactor: Interactor, |
| 555 | positionals: string[], |
| 556 | context: DispatchContext | undefined, |
| 557 | ): Promise<Record<string, unknown>> { |
| 558 | const x1 = Number(positionals[0]); |
| 559 | const y1 = Number(positionals[1]); |
| 560 | const x2 = Number(positionals[2]); |
| 561 | const y2 = Number(positionals[3]); |
| 562 | if ([x1, y1, x2, y2].some(Number.isNaN)) { |
| 563 | throw new AppError('INVALID_ARGS', 'swipe requires x1 y1 x2 y2 [durationMs]'); |
| 564 | } |
| 565 | |
| 566 | const requestedDurationMs = positionals[4] ? Number(positionals[4]) : 250; |
| 567 | return await runSwipeCoordinates({ |
| 568 | device, |
| 569 | interactor, |
| 570 | context, |
| 571 | x1, |
| 572 | y1, |
| 573 | x2, |
| 574 | y2, |
| 575 | requestedDurationMs, |
| 576 | }); |
| 577 | } |
| 578 | |
| 579 | export async function handleSwipePresetCommand( |
| 580 | device: DeviceInfo, |
no test coverage detected