Expose current connection status to Sandy plugins

Summary:
Introduced `isConnected` flag on device and plugin client to reflect whether a connection is still available for the plugins, or that they have been disconnected.

Potentially we could expose the (readonly) `connected` state atom for this as well, or an `onDisconnect` event for device pugins, to create a responsive UI, but there might be no need for that, in which case this suffices.

Reviewed By: nikoant

Differential Revision: D26249346

fbshipit-source-id: b8486713fdf2fcd520488ce54f771bd038fd13f8
This commit is contained in:
Michel Weststrate
2021-02-09 04:12:09 -08:00
committed by Facebook GitHub Bot
parent 7e1bf0f58b
commit bb529411b5
6 changed files with 62 additions and 16 deletions

View File

@@ -36,6 +36,7 @@ export type LogLevel =
export interface Device {
readonly realDevice: any; // TODO: temporarily, clean up T70688226
readonly isArchived: boolean;
readonly isConnected: boolean;
readonly os: string;
readonly deviceType: DeviceType;
onLogEntry(cb: DeviceLogListener): () => void;
@@ -79,7 +80,7 @@ export class SandyDevicePluginInstance extends BasePluginInstance {
}
/** client that is bound to this instance */
client: DevicePluginClient;
readonly client: DevicePluginClient;
constructor(
flipperLib: FlipperLib,