Move devices to server folder
Summary: This is the first of many diffs that extracts the connection, device, client detection out of the flipper core, to create a reusable flipper-server library that can be used in e.g. flipper-dump. To keep diffs a little smaller, the current connection logic is first moved to the `server/` directory, and decoupled manually from the rest of the core, before moving it over to a separate package. This first diffs moves the `comms/`, `devices/` and certificate utilities to the `server` directory. Further untangling will follow in next diffs Reviewed By: timur-valiev Differential Revision: D30246551 fbshipit-source-id: c84259bfb1239119b3267a51b015e30c3c080866
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5e350add4f
commit
5e8c968222
@@ -10,7 +10,7 @@
|
||||
import type {PluginDefinition} from '../plugin';
|
||||
import type {State} from '../reducers';
|
||||
import type {State as PluginsState} from '../reducers/plugins';
|
||||
import type BaseDevice from '../devices/BaseDevice';
|
||||
import type BaseDevice from '../server/devices/BaseDevice';
|
||||
import type Client from '../Client';
|
||||
import type {
|
||||
ActivatablePluginDetails,
|
||||
@@ -19,6 +19,7 @@ import type {
|
||||
PluginDetails,
|
||||
} from 'flipper-plugin-lib';
|
||||
import {getLatestCompatibleVersionOfEachPlugin} from '../dispatcher/plugins';
|
||||
import {getPluginKey} from './pluginKey';
|
||||
|
||||
export type PluginLists = {
|
||||
devicePlugins: PluginDefinition[];
|
||||
@@ -63,25 +64,6 @@ export function pluginsClassMap(
|
||||
]);
|
||||
}
|
||||
|
||||
export function getPluginKey(
|
||||
selectedAppId: string | null | undefined,
|
||||
baseDevice: {serial: string} | null | undefined,
|
||||
pluginID: string,
|
||||
): string {
|
||||
if (selectedAppId) {
|
||||
return `${selectedAppId}#${pluginID}`;
|
||||
}
|
||||
if (baseDevice) {
|
||||
// If selected App is not defined, then the plugin is a device plugin
|
||||
return `${baseDevice.serial}#${pluginID}`;
|
||||
}
|
||||
return `unknown#${pluginID}`;
|
||||
}
|
||||
|
||||
export const pluginKey = (serial: string, pluginName: string): string => {
|
||||
return `${serial}#${pluginName}`;
|
||||
};
|
||||
|
||||
export function computeExportablePlugins(
|
||||
state: Pick<State, 'plugins' | 'connections' | 'pluginMessageQueue'>,
|
||||
device: BaseDevice | null,
|
||||
|
||||
Reference in New Issue
Block a user