Make sure disconnected devices / apps can be imported and exported

Summary:
It should be possible to exported disconnected devices, so that flipper traces / support form reports can be created from them. This diff introduces this functionality. Support for plugins with custom export logic is introduced in a later diff.

Issues fixed in this diff:
- don't try to take a screenshot for a disconnected device (this would hang forever)
- device plugins were always exported, regardless whether the user did select them or not
- sandy plugins were never part of exported disconnected clients
- increased the amount of data exported for device logs to ~10 MB. This makes more sense now as the logs will no longer be included in all cases
- fixed issue where are plugins would appear to be enabled after the client disconnected (this bug is the result of some unfortunate naming of `isArchived` vs `isConnected` semantics. Will clean up those names in a later diff.

Changelog: It is now possible to create a Flipper trace for disconnected devices and apps

Reviewed By: nikoant

Differential Revision: D26250894

fbshipit-source-id: 4dd0ec0cb152b1a8f649c31913e80efc25bcc5dd
This commit is contained in:
Michel Weststrate
2021-02-09 04:12:09 -08:00
committed by Facebook GitHub Bot
parent 8bc1b953c2
commit ff7997b3fa
11 changed files with 65 additions and 29 deletions

View File

@@ -276,7 +276,13 @@ export class SandyPluginInstance extends BasePluginInstance {
private assertConnected() {
this.assertNotDestroyed();
if (!this.connected.get()) {
if (
// This is a better-safe-than-sorry; just the first condition should suffice
!this.connected.get() ||
!this.realClient.connected.get() ||
!this.device.isConnected ||
this.device.isArchived
) {
throw new Error('Plugin is not connected');
}
}