(runtime, options = {})
| 131 | SystemBackCommandOptions | undefined, |
| 132 | SystemBackCommandResult |
| 133 | > = async (runtime, options = {}): Promise<SystemBackCommandResult> => { |
| 134 | if (!runtime.backend.pressBack) { |
| 135 | throw new AppError('UNSUPPORTED_OPERATION', 'system.back is not supported by this backend'); |
| 136 | } |
| 137 | const mode = options.mode ?? 'in-app'; |
| 138 | if (mode !== 'in-app' && mode !== 'system') { |
| 139 | throw new AppError('INVALID_ARGS', 'system.back mode must be in-app or system'); |
| 140 | } |
| 141 | const backendResult = await runtime.backend.pressBack(toBackendContext(runtime, options), { |
| 142 | mode, |
| 143 | }); |
| 144 | const formattedBackendResult = toBackendResult(backendResult); |
| 145 | return { |
| 146 | kind: 'systemBack', |
| 147 | mode, |
| 148 | ...(formattedBackendResult ? { backendResult: formattedBackendResult } : {}), |
| 149 | ...successText('Back'), |
| 150 | }; |
| 151 | }; |
| 152 | |
| 153 | export const homeCommand: RuntimeCommand< |
| 154 | SystemHomeCommandOptions | undefined, |
nothing calls this directly
no test coverage detected