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

Function createDispatchScreenshotBackend

src/daemon/screenshot-runtime.ts:48–75  ·  view source on GitHub ↗
(params: {
  session: SessionState;
  outputPlacement: ScreenshotOutputPlacement;
  dispatchContext: DaemonCommandContext;
})

Source from the content-addressed store, hash-verified

46}
47
48function createDispatchScreenshotBackend(params: {
49 session: SessionState;
50 outputPlacement: ScreenshotOutputPlacement;
51 dispatchContext: DaemonCommandContext;
52}): AgentDeviceBackend {
53 const { session, outputPlacement, dispatchContext } = params;
54 return {
55 platform: publicPlatformString(session.device),
56 captureScreenshot: async (_context, outPath, options) => {
57 const context = {
58 ...dispatchContext,
59 ...screenshotFlagsFromOptions(options),
60 surface: options?.surface,
61 skipIosSimulatorBootCheck:
62 dispatchContext.skipIosSimulatorBootCheck ??
63 (isIosFamily(session.device) && session.device.kind === 'simulator'),
64 };
65 if (outputPlacement === 'out') {
66 return readScreenshotResultData(
67 await dispatchCommand(session.device, 'screenshot', [], outPath, context),
68 );
69 }
70 return readScreenshotResultData(
71 await dispatchCommand(session.device, 'screenshot', [outPath], undefined, context),
72 );
73 },
74 };
75}
76
77function createDaemonScreenshotArtifactAdapter(): ArtifactAdapter {
78 return {

Callers 1

Calls 5

publicPlatformStringFunction · 0.90
isIosFamilyFunction · 0.90
readScreenshotResultDataFunction · 0.90
dispatchCommandFunction · 0.90

Tested by

no test coverage detected