( device: DeviceInfo, positionals: string[], context: DispatchContext | undefined, runnerCtx: RunnerContext, )
| 391 | } |
| 392 | |
| 393 | async function handleKeyboardCommand( |
| 394 | device: DeviceInfo, |
| 395 | positionals: string[], |
| 396 | context: DispatchContext | undefined, |
| 397 | runnerCtx: RunnerContext, |
| 398 | ): Promise<Record<string, unknown>> { |
| 399 | const action = (positionals[0] ?? 'status').toLowerCase(); |
| 400 | if (!isKeyboardAction(action)) { |
| 401 | throw new AppError( |
| 402 | 'INVALID_ARGS', |
| 403 | 'keyboard requires a subcommand: status, get, dismiss, enter, or return', |
| 404 | ); |
| 405 | } |
| 406 | if (positionals.length > 1) { |
| 407 | throw new AppError('INVALID_ARGS', 'keyboard accepts at most one subcommand argument'); |
| 408 | } |
| 409 | if (device.platform === 'android') { |
| 410 | return await handleAndroidKeyboardCommand(device, action); |
| 411 | } |
| 412 | if (isIosFamily(device)) { |
| 413 | return await handleIosKeyboardCommand(device, action, context, runnerCtx); |
| 414 | } |
| 415 | throw new AppError('UNSUPPORTED_OPERATION', 'keyboard is supported only on Android and iOS'); |
| 416 | } |
| 417 | |
| 418 | async function handleAndroidKeyboardCommand( |
| 419 | device: DeviceInfo, |
no test coverage detected