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

Function handlePressCommand

src/core/dispatch-interactions.ts:149–178  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  interactor: Interactor,
  positionals: string[],
  context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

147}
148
149export async function handlePressCommand(
150 device: DeviceInfo,
151 interactor: Interactor,
152 positionals: string[],
153 context: DispatchContext | undefined,
154): Promise<Record<string, unknown>> {
155 if (context?.directElementSelector && isIosFamily(device)) {
156 return await handleDirectElementSelectorPress(interactor, context.directElementSelector);
157 }
158
159 const { x, y } = readPoint(positionals, 'press requires x y');
160
161 if (isMacOs(device) && context?.surface && context.surface !== 'app') {
162 return await handleMacOsSurfacePress(x, y, context);
163 }
164
165 const clickButton = resolveClickButton(context);
166 if (clickButton !== 'primary') {
167 return await handleAlternateClick(device, x, y, clickButton, context);
168 }
169
170 const series = readPressSeriesOptions(context);
171 validatePressSeriesOptions(series);
172
173 if (shouldUseIosPressSequence(device, series.count)) {
174 return await runIosPressSequence(device, x, y, series, context);
175 }
176
177 return await runDirectPressSeries(interactor, x, y, series);
178}
179
180async function handleDirectElementSelectorPress(
181 interactor: Interactor,

Callers 2

dispatch.tsFile · 0.90

Calls 12

isIosFamilyFunction · 0.90
isMacOsFunction · 0.90
resolveClickButtonFunction · 0.90
handleMacOsSurfacePressFunction · 0.85
handleAlternateClickFunction · 0.85
readPressSeriesOptionsFunction · 0.85
runIosPressSequenceFunction · 0.85
runDirectPressSeriesFunction · 0.85
readPointFunction · 0.70

Tested by

no test coverage detected