MCPcopy Index your code
hub / github.com/callstack/agent-device / handlePushCommand

Function handlePushCommand

src/core/dispatch.ts:583–612  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  positionals: string[],
  _context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

581}
582
583async 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
614async function handleSnapshotCommand(
615 interactor: Interactor,

Callers 1

dispatch.tsFile · 0.85

Calls 5

readNotificationPayloadFunction · 0.90
isIosFamilyFunction · 0.90
successTextFunction · 0.90
pushIosNotificationFunction · 0.85
pushAndroidNotificationFunction · 0.85

Tested by

no test coverage detected