| 79 | }); |
| 80 | |
| 81 | function createSystemBackend(calls: unknown[]): AgentDeviceBackend { |
| 82 | return { |
| 83 | platform: 'ios', |
| 84 | pressBack: async (context, options) => { |
| 85 | calls.push({ command: 'pressBack', mode: options?.mode, session: context.session }); |
| 86 | return { ok: true }; |
| 87 | }, |
| 88 | pressHome: async (context) => { |
| 89 | calls.push({ command: 'pressHome', session: context.session }); |
| 90 | }, |
| 91 | rotate: async (_context, orientation) => { |
| 92 | calls.push({ command: 'rotate', orientation }); |
| 93 | }, |
| 94 | setKeyboard: async (_context, options) => { |
| 95 | calls.push({ command: 'setKeyboard', options }); |
| 96 | return { action: options.action, dismissed: true, visible: false }; |
| 97 | }, |
| 98 | getClipboard: async () => { |
| 99 | calls.push({ command: 'getClipboard' }); |
| 100 | return { text: 'copied' }; |
| 101 | }, |
| 102 | setClipboard: async (_context, text) => { |
| 103 | calls.push({ command: 'setClipboard', text }); |
| 104 | }, |
| 105 | openSettings: async (_context, target) => { |
| 106 | calls.push({ command: 'openSettings', target }); |
| 107 | }, |
| 108 | handleAlert: async (_context, action, options) => { |
| 109 | calls.push({ command: 'handleAlert', action, timeoutMs: options?.timeoutMs }); |
| 110 | return { kind: 'alertHandled', handled: true, button: 'OK' }; |
| 111 | }, |
| 112 | openAppSwitcher: async () => { |
| 113 | calls.push({ command: 'openAppSwitcher' }); |
| 114 | }, |
| 115 | }; |
| 116 | } |