Move common types to flipper-plugin [1/n]

Summary: This is the first diff in a stack of many where server and UI logic is further decoupled to be only communication through an event listener / emitting commands, where all data going over these media is json serializable. In this diff we extract the common interfaces that are to be used by both server and UI layer.

Reviewed By: passy

Differential Revision: D30899609

fbshipit-source-id: dc3c783707d47671f1d0f5dbf99cde17a8f69062
This commit is contained in:
Michel Weststrate
2021-09-22 09:01:29 -07:00
committed by Facebook GitHub Bot
parent d5aaa0034d
commit 845d0755f1
23 changed files with 136 additions and 82 deletions

View File

@@ -10,8 +10,8 @@
import {SandyPluginDefinition} from './SandyPluginDefinition';
import {BasePluginInstance, BasePluginClient} from './PluginBase';
import {FlipperLib} from './FlipperLib';
import {DeviceType as PluginDeviceType} from 'flipper-plugin-lib';
import {Atom, ReadOnlyAtom} from '../state/atom';
import {DeviceOS, DeviceType} from '../types/server-types';
export type DeviceLogListener = (entry: DeviceLogEntry) => void;
@@ -38,14 +38,12 @@ export interface Device {
readonly realDevice: any; // TODO: temporarily, clean up T70688226
readonly isArchived: boolean;
readonly isConnected: boolean;
readonly os: string;
readonly os: DeviceOS;
readonly serial: string;
readonly deviceType: DeviceType;
onLogEntry(cb: DeviceLogListener): () => void;
}
export type DeviceType = PluginDeviceType;
export type DevicePluginPredicate = (device: Device) => boolean;
export type DevicePluginFactory = (client: DevicePluginClient) => object;
@@ -64,7 +62,7 @@ export interface DevicePluginClient extends BasePluginClient {
* Wrapper interface around BaseDevice in Flipper
*/
export interface RealFlipperDevice {
os: string;
os: DeviceOS;
serial: string;
isArchived: boolean;
connected: Atom<boolean>;