Files
flipper/src/devices/ArchivedDevice.tsx
Michel Weststrate dcb6595d1d Make imported devices visually recognizable
Summary:
If a flipper file is imported, from now on we will show that fact in the sidebar to make it more clear we are looking at an imported device. Beyond that, those devices are marked as `(imported)` rather than `(offline)` to distinguish between offline and imported devices.

This should help with future feature like cross device applicable actions.

Reviewed By: jknoxville

Differential Revision: D18448190

fbshipit-source-id: 560084f010207c99cecd616e43a6cc02e62cbc7a
2019-11-13 08:36:56 -08:00

54 lines
1.2 KiB
TypeScript

/**
* 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 from './BaseDevice';
import {DeviceType, OS, DeviceShell, DeviceLogEntry} from './BaseDevice';
function normalizeArchivedDeviceType(deviceType: DeviceType): DeviceType {
let archivedDeviceType = deviceType;
if (archivedDeviceType === 'emulator') {
archivedDeviceType = 'archivedEmulator';
} else if (archivedDeviceType === 'physical') {
archivedDeviceType = 'archivedPhysical';
}
return archivedDeviceType;
}
export default class ArchivedDevice extends BaseDevice {
constructor(
serial: string,
deviceType: DeviceType,
title: string,
os: OS,
logEntries: Array<DeviceLogEntry>,
source: string = '',
) {
super(serial, normalizeArchivedDeviceType(deviceType), title, os);
this.logs = logEntries;
this.source = source;
}
logs: Array<DeviceLogEntry>;
isArchived = true;
getLogs() {
return this.logs;
}
clearLogs(): Promise<void> {
this.logs = [];
return Promise.resolve();
}
spawnShell(): DeviceShell | undefined | null {
return null;
}
}