(withBezel: boolean)
| 2060 | } |
| 2061 | |
| 2062 | async function downloadSimulatorScreenshot(withBezel: boolean) { |
| 2063 | if (!selectedSimulator) { |
| 2064 | return; |
| 2065 | } |
| 2066 | setLocalError(""); |
| 2067 | const statusLabel = withBezel |
| 2068 | ? "Capturing screenshot with bezel..." |
| 2069 | : "Capturing screenshot..."; |
| 2070 | setTransientCaptureStatus(statusLabel, true); |
| 2071 | try { |
| 2072 | const blob = await captureSimulatorScreenshot(selectedSimulator.udid, { |
| 2073 | withBezel, |
| 2074 | }); |
| 2075 | downloadBlob( |
| 2076 | blob, |
| 2077 | `${captureFileBaseName(selectedSimulator, "Screenshot")}${withBezel ? " Bezel" : ""}.png`, |
| 2078 | ); |
| 2079 | const successLabel = "Screenshot downloaded"; |
| 2080 | setTransientCaptureStatus(successLabel, false); |
| 2081 | clearCaptureStatusLater(successLabel); |
| 2082 | } catch (captureError) { |
| 2083 | setCaptureStatus(null); |
| 2084 | setLocalError( |
| 2085 | captureError instanceof Error |
| 2086 | ? captureError.message |
| 2087 | : "Capture failed.", |
| 2088 | ); |
| 2089 | } |
| 2090 | } |
| 2091 | |
| 2092 | async function toggleSimulatorRecording() { |
| 2093 | if (!selectedSimulator) { |
no test coverage detected