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

Function chooseAndroidAlertButton

src/platforms/android/alert-detection.ts:68–80  ·  view source on GitHub ↗
(
  buttons: AndroidAlertButton[],
  action: 'accept' | 'dismiss',
)

Source from the content-addressed store, hash-verified

66}
67
68export function chooseAndroidAlertButton(
69 buttons: AndroidAlertButton[],
70 action: 'accept' | 'dismiss',
71): AndroidAlertButton | null {
72 const role = action === 'accept' ? 'accept' : 'dismiss';
73 const exact = buttons.find((button) => button.role === role);
74 if (exact) return exact;
75 if (action === 'dismiss') {
76 return buttons.find((button) => button.role === 'neutral') ?? null;
77 }
78 // Single-button Android dialogs commonly expose the only affirmative path as OK.
79 return buttons.length === 1 ? (buttons[0] ?? null) : null;
80}
81
82function findAndroidAlertNodes(nodes: RawSnapshotNode[]): {
83 nodes: RawSnapshotNode[];

Callers 2

handleAndroidAlertActionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…