diff --git a/electron/exposes/adb/index.js b/electron/exposes/adb/index.js index a560c4ba..2b52b197 100644 --- a/electron/exposes/adb/index.js +++ b/electron/exposes/adb/index.js @@ -128,18 +128,12 @@ const tcpip = async (id, port = 5555) => client.getDevice(id).tcpip(port) const screencap = async (deviceId, options = {}) => { const { returnBase64 = false } = options - let fileStream = null - try { - const device = client.getDevice(deviceId) - fileStream = await device.screencap() - } - catch (error) { - console.warn(error?.message || error) - return false - } + const device = client.getDevice(deviceId) + + const fileStream = await device.screencap() if (!fileStream) { - return false + throw new Error('Failed to obtain screenshot data') } if (returnBase64) { @@ -292,17 +286,11 @@ async function connectCode(password, options = {}) { } async function battery(id) { - try { - const res = await deviceShell(id, 'dumpsys battery') + const res = await deviceShell(id, 'dumpsys battery') - const value = parseBatteryDump(res) + const value = parseBatteryDump(res) - return value - } - catch (error) { - console.warn(error?.message || error) - return {} - } + return value } function init() { diff --git a/package.json b/package.json index bd1aae18..a794ac88 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "devDependencies": { "@antfu/eslint-config": "3.8.0", - "@devicefarmer/adbkit": "3.2.6", + "@devicefarmer/adbkit": "3.3.8", "@electron-toolkit/preload": "3.0.1", "@electron-toolkit/utils": "3.0.0", "@electron/remote": "2.1.2", diff --git a/src/components/ControlBar/index.vue b/src/components/ControlBar/index.vue index 0838d5b6..9a33203a 100644 --- a/src/components/ControlBar/index.vue +++ b/src/components/ControlBar/index.vue @@ -1,6 +1,6 @@