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

Function resolveCommandDevice

src/daemon/handlers/session-device-utils.ts:41–58  ·  view source on GitHub ↗
(params: {
  session: SessionState | undefined;
  flags: DaemonRequest['flags'] | undefined;
  ensureReady?: boolean;
  allowStoppedAndroidAvdPlaceholders?: boolean;
})

Source from the content-addressed store, hash-verified

39}
40
41export async function resolveCommandDevice(params: {
42 session: SessionState | undefined;
43 flags: DaemonRequest['flags'] | undefined;
44 ensureReady?: boolean;
45 allowStoppedAndroidAvdPlaceholders?: boolean;
46}): Promise<DeviceInfo> {
47 const shouldUseExplicitSelector = hasExplicitDeviceSelector(params.flags);
48 const device =
49 shouldUseExplicitSelector || !params.session
50 ? await resolveTargetDevice(params.flags ?? {}, {
51 allowStoppedAndroidAvdPlaceholders: params.allowStoppedAndroidAvdPlaceholders,
52 })
53 : await refreshSessionDeviceIfNeeded(params.session.device);
54 if (params.ensureReady !== false) {
55 await ensureDeviceReady(device);
56 }
57 return device;
58}
59
60export async function refreshSessionDeviceIfNeeded(device: DeviceInfo): Promise<DeviceInfo> {
61 if (!isIosFamily(device) || device.kind !== 'simulator') {

Callers 8

handleAppDeployCommandFunction · 0.90
closeWithoutSessionFunction · 0.90
handlePrepareCommandFunction · 0.90
handleClipboardCommandFunction · 0.90
handleAppStateCommandFunction · 0.90

Calls 4

resolveTargetDeviceFunction · 0.90
ensureDeviceReadyFunction · 0.90

Tested by

no test coverage detected