Fix error that is logged when device disconnected quickly

Summary: If a device disconnects quickly, trying to determine whether screenshots and alike are supported would throw, showing up in our monitoring (see attached tasks). This change fixes that

Reviewed By: nikoant

Differential Revision: D34105451

fbshipit-source-id: 8d3d6dd4c2c82f70cdff710722d789e7c1d73693
This commit is contained in:
Michel Weststrate
2022-02-09 04:21:47 -08:00
committed by Facebook GitHub Bot
parent 597f679ed3
commit d81a9909e0

View File

@@ -333,9 +333,13 @@ export class FlipperServerImpl implements FlipperServer {
return Array.from(this.devices.values()).map((d) => d.info);
},
'device-supports-screenshot': async (serial: string) =>
this.getDevice(serial).screenshotAvailable(),
this.devices.has(serial)
? this.getDevice(serial).screenshotAvailable()
: false,
'device-supports-screencapture': async (serial: string) =>
this.getDevice(serial).screenCaptureAvailable(),
this.devices.has(serial)
? this.getDevice(serial).screenCaptureAvailable()
: false,
'device-take-screenshot': async (serial: string) =>
Base64.fromUint8Array(await this.getDevice(serial).screenshot()),
'device-start-screencapture': async (serial, destination) =>