Use ArchivedDevice from flipper-frontend-core in flipper-ui-core

Summary: See D37139129

Reviewed By: lblasa

Differential Revision: D37235514

fbshipit-source-id: 54124f2b9768b068ae667b27171eaa05a693b398
This commit is contained in:
Andrey Goncharov
2022-06-20 12:18:40 -07:00
committed by Facebook GitHub Bot
parent fd380a4c1e
commit a648861273
5 changed files with 4 additions and 86 deletions

View File

@@ -21,11 +21,10 @@ import {
import {PluginDefinition} from '../../plugin';
import {pluginsInitialized, registerPlugins} from '../../reducers/plugins';
import {getLogger} from 'flipper-common';
import {ClientConnection} from 'flipper-frontend-core';
import {ClientConnection, ArchivedDevice} from 'flipper-frontend-core';
import {initializeFlipperLibImplementation} from '../../utils/flipperLibImplementation';
import pluginManager from '../../dispatcher/pluginManager';
import {PluginDetails} from 'flipper-common';
import ArchivedDevice from '../../devices/ArchivedDevice';
import {ClientQuery, DeviceOS} from 'flipper-common';
import {TestDevice} from '../../devices/TestDevice';
import {getRenderHostInstance} from '../../RenderHost';

View File

@@ -31,11 +31,10 @@ export {getPluginKey} from './utils/pluginKey';
export {Notification, Idler} from 'flipper-plugin';
export {IdlerImpl} from './utils/Idler';
export {Store, State as ReduxState} from './reducers/index';
export {BaseDevice} from 'flipper-frontend-core';
export {BaseDevice, ArchivedDevice} from 'flipper-frontend-core';
export {default as isProduction} from './utils/isProduction';
export {DetailSidebar} from 'flipper-plugin';
export {BaseDevice as Device} from 'flipper-frontend-core';
export {default as ArchivedDevice} from './devices/ArchivedDevice';
export {DeviceOS as OS} from 'flipper-plugin';
export {default as Button} from './ui/components/Button';
export {default as ToggleButton} from './ui/components/ToggleSwitch';

View File

@@ -1,80 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and 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} from 'flipper-frontend-core';
import type {DeviceOS, DeviceType} from 'flipper-plugin';
export default class ArchivedDevice extends BaseDevice {
isArchived = true;
constructor(options: {
serial: string;
deviceType: DeviceType;
title: string;
os: DeviceOS;
screenshotHandle?: string | null;
source?: string;
}) {
super(
{
async connect() {},
close() {},
exec(command, ..._args: any[]) {
throw new Error(
`[Archived device] Cannot invoke command ${command} on an archived device`,
);
},
on(event) {
console.warn(
`Cannot subscribe to server events from an Archived device: ${event}`,
);
},
off() {},
},
{
deviceType: options.deviceType,
title: options.title,
os: options.os,
serial: options.serial,
icon: 'box',
features: {
screenCaptureAvailable: false,
screenshotAvailable: false,
},
},
);
this.connected.set(false);
this.source = options.source || '';
this.archivedScreenshotHandle = options.screenshotHandle ?? null;
}
archivedScreenshotHandle: string | null;
displayTitle(): string {
return `${this.title} ${this.source ? '(Imported)' : '(Offline)'}`;
}
getArchivedScreenshotHandle(): string | null {
return this.archivedScreenshotHandle;
}
/**
* @override
*/
async startLogging() {
// No-op
}
/**
* @override
*/
async stopLogging() {
// No-op
}
}

View File

@@ -11,7 +11,7 @@ import * as DeviceTestPluginModule from '../../__tests__/test-utils/DeviceTestPl
import {TestUtils, _SandyPluginDefinition} from 'flipper-plugin';
import {createMockFlipperWithPlugin} from '../../__tests__/test-utils/createMockFlipperWithPlugin';
import {TestDevice} from '../../devices/TestDevice';
import ArchivedDevice from '../../devices/ArchivedDevice';
import {ArchivedDevice} from 'flipper-frontend-core';
const physicalDevicePluginDetails = TestUtils.createMockPluginDetails({
id: 'physicalDevicePlugin',

View File

@@ -11,7 +11,7 @@
import {State} from '../../reducers/index';
import configureStore from 'redux-mock-store';
import {default as ArchivedDevice} from '../../devices/ArchivedDevice';
import {ArchivedDevice} from 'flipper-frontend-core';
import {
processStore,
determinePluginsToProcess,