Register Flipper self inspection client under its own device

Summary:
There is currently a separate device for the Flipper inspection plugin. Figured it would be simpler and more logical to directly put it under the host device.

Might clean this up further in the future by having a `host` device and turning this into a device plugin

Reviewed By: fabiomassimo

Differential Revision: D26691053

fbshipit-source-id: 4f2fe890a1fff559b19b1599cc02017c45a635b9
This commit is contained in:
Michel Weststrate
2021-02-26 07:24:40 -08:00
committed by Facebook GitHub Bot
parent 86e700f918
commit a5cd18c289
2 changed files with 10 additions and 33 deletions

View File

@@ -1,18 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import BaseDevice, {OS} from './BaseDevice';
import type {DeviceType} from 'flipper-plugin';
export default class FlipperSelfInspectionDevice extends BaseDevice {
constructor(serial: string, deviceType: DeviceType, title: string, os: OS) {
super(serial, deviceType, title, os);
this.devicePlugins = [];
}
}

View File

@@ -9,7 +9,6 @@
import Client, {ClientQuery} from '../../Client';
import {FlipperClientConnection} from '../../Client';
import FlipperSelfInspectionDevice from '../../devices/FlipperSelfInspectionDevice';
import {Store} from '../../reducers';
import {Logger} from '../../fb-interfaces/Logger';
@@ -31,25 +30,21 @@ export function initSelfInpector(
>,
) {
const appName = 'Flipper';
const device_id = 'FlipperSelfInspectionDevice';
const device = new FlipperSelfInspectionDevice(
device_id,
'emulator',
appName,
'JSWebApp',
);
store.dispatch({
type: 'REGISTER_DEVICE',
payload: device,
});
selfInspectionClient.addPlugin(flipperMessagesClientPlugin);
const hostDevice = store
.getState()
.connections.devices.find((d) => d.serial === '');
if (!hostDevice) {
console.error('Failed to find host device for self inspector');
return;
}
const query: ClientQuery = {
app: appName,
os: 'JSWebApp',
os: 'MacOS',
device: 'emulator',
device_id,
device_id: '',
sdk_version: 4,
};
const clientId = buildClientId(query);
@@ -61,7 +56,7 @@ export function initSelfInpector(
logger,
store,
undefined,
device,
hostDevice,
);
flipperConnections.set(clientId, {