( buttons: AndroidAlertButton[], action: 'accept' | 'dismiss', )
| 66 | } |
| 67 | |
| 68 | export 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 | |
| 82 | function findAndroidAlertNodes(nodes: RawSnapshotNode[]): { |
| 83 | nodes: RawSnapshotNode[]; |
no outgoing calls
no test coverage detected
searching dependent graphs…