( device: DeviceInfo, positionals: string[], _context: DispatchContext | undefined, )
| 581 | } |
| 582 | |
| 583 | async function handlePushCommand( |
| 584 | device: DeviceInfo, |
| 585 | positionals: string[], |
| 586 | _context: DispatchContext | undefined, |
| 587 | ): Promise<Record<string, unknown>> { |
| 588 | const target = positionals[0]?.trim(); |
| 589 | const payloadArg = positionals[1]?.trim(); |
| 590 | if (!target || !payloadArg) { |
| 591 | throw new AppError('INVALID_ARGS', 'push requires <bundle|package> <payload.json|inline-json>'); |
| 592 | } |
| 593 | const payload = await readNotificationPayload(payloadArg); |
| 594 | if (isIosFamily(device)) { |
| 595 | const { pushIosNotification } = await import('../platforms/apple/core/apps.ts'); |
| 596 | await pushIosNotification(device, target, payload); |
| 597 | return { |
| 598 | platform: 'ios', |
| 599 | bundleId: target, |
| 600 | ...successText(`Pushed notification to ${target}`), |
| 601 | }; |
| 602 | } |
| 603 | const { pushAndroidNotification } = await import('../platforms/android/notifications.ts'); |
| 604 | const androidResult = await pushAndroidNotification(device, target, payload); |
| 605 | return { |
| 606 | platform: 'android', |
| 607 | package: target, |
| 608 | action: androidResult.action, |
| 609 | extrasCount: androidResult.extrasCount, |
| 610 | ...successText(`Pushed notification to ${target}`), |
| 611 | }; |
| 612 | } |
| 613 | |
| 614 | async function handleSnapshotCommand( |
| 615 | interactor: Interactor, |
no test coverage detected