(
action: () => Promise<unknown>,
refreshAfter = true,
)
| 2008 | }; |
| 2009 | |
| 2010 | async function runAction( |
| 2011 | action: () => Promise<unknown>, |
| 2012 | refreshAfter = true, |
| 2013 | ): Promise<boolean> { |
| 2014 | setLocalError(""); |
| 2015 | try { |
| 2016 | await action(); |
| 2017 | if (refreshAfter) { |
| 2018 | await refresh(); |
| 2019 | } |
| 2020 | return true; |
| 2021 | } catch (actionError) { |
| 2022 | setLocalError( |
| 2023 | actionError instanceof Error ? actionError.message : "Request failed.", |
| 2024 | ); |
| 2025 | return false; |
| 2026 | } |
| 2027 | } |
| 2028 | |
| 2029 | function toggleSoftwareKeyboard() { |
| 2030 | if (!selectedSimulator) { |
no test coverage detected