Handle the case of Logs not being present

Summary:
- handles the case when log is not present
- solved the cpu plugin error
- now `fileversion` is the flipper version

Reviewed By: jknoxville, danielbuechele

Differential Revision: D14065882

fbshipit-source-id: f88414bbb3d766f8ab6e0ec00943b59738918a0e
This commit is contained in:
Pritesh Nandgaonkar
2019-02-14 04:50:34 -08:00
committed by Facebook Github Bot
parent a41d8eb4f8
commit 9a8e30681b

View File

@@ -18,9 +18,10 @@ import {default as Client} from '../Client';
import {getInstance} from '../fb-stubs/Logger.js';
import fs from 'fs';
import uuid from 'uuid';
import {remote} from 'electron';
export type ExportType = {|
fileVersion: '1.0.0',
fileVersion: string,
clients: Array<ClientExport>,
device: ?DeviceExport,
store: {
@@ -126,7 +127,7 @@ const addSaltToDeviceSerial = (
return {...notif, client: notif.client.replace(serial, newSerial)};
});
return {
fileVersion: '1.0.0',
fileVersion: remote.app.getVersion(),
clients: updatedClients,
device: newDevice.toJSON(),
store: {
@@ -216,11 +217,13 @@ export const importFileToStore = (file: string, store: Store) => {
}
const json = JSON.parse(data);
const {device, clients} = json;
const updatedLogs = device.logs.map(log => {
const {serial, deviceType, title, os, logs} = device;
const updatedLogs = logs
? logs.map(log => {
// During the export, Date is exported as string
return {...log, date: new Date(log.date)};
});
const {serial, deviceType, title, os} = device;
})
: [];
const archivedDevice = new ArchivedDevice(
serial,
deviceType,