MCPcopy Create free account
hub / github.com/callstack/agent-device / tapAndroidDialogButton

Function tapAndroidDialogButton

src/daemon/android-system-dialog.ts:270–292  ·  view source on GitHub ↗
(
  session: SessionState,
  button: SnapshotNode,
)

Source from the content-addressed store, hash-verified

268}
269
270async function tapAndroidDialogButton(
271 session: SessionState,
272 button: SnapshotNode,
273): Promise<AndroidDialogButtonTapResult> {
274 if (!button.rect) {
275 return { ok: false, exitCode: 1, stdout: '', stderr: 'button has no rect' };
276 }
277 const { x, y } = centerOfRect(button.rect);
278 const result = await runAndroidAdb(
279 session.device,
280 ['shell', 'input', 'tap', String(Math.round(x)), String(Math.round(y))],
281 { allowFailure: true },
282 );
283 if (result.exitCode !== 0) {
284 return {
285 ok: false,
286 exitCode: result.exitCode,
287 stdout: result.stdout.trim(),
288 stderr: result.stderr.trim(),
289 };
290 }
291 return { ok: true, x, y };
292}
293
294function findCloseAppButton(
295 nodes: SnapshotNode[],

Calls 2

centerOfRectFunction · 0.90
runAndroidAdbFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…