Use named args for ArchivedDevice constructor

Summary: The constructor is getting quite a few args now, so to avoid string, string mistakes I'm making sure you pass objects with named params.

Reviewed By: passy, mweststrate

Differential Revision: D20034012

fbshipit-source-id: 4e0d23eeaa9100c6c19d3e36fee62649659ad261
This commit is contained in:
John Knox
2020-02-24 19:41:33 -08:00
committed by Facebook Github Bot
parent 609ca27eae
commit b3a6bf3dba
5 changed files with 176 additions and 171 deletions

View File

@@ -268,14 +268,14 @@ const addSaltToDeviceSerial = async (
} = options;
const {serial} = device;
const newSerial = salt + '-' + serial;
const newDevice = new ArchivedDevice(
newSerial,
device.deviceType,
device.title,
device.os,
selectedPlugins.includes('DeviceLogs') ? device.getLogs() : [],
deviceScreenshot,
);
const newDevice = new ArchivedDevice({
serial: newSerial,
deviceType: device.deviceType,
title: device.title,
os: device.os,
logEntries: selectedPlugins.includes('DeviceLogs') ? device.getLogs() : [],
screenshotHandle: deviceScreenshot,
});
statusUpdate &&
statusUpdate('Adding salt to the selected device id in the client data...');
const updatedClients = clients.map((client: ClientExport) => {
@@ -681,20 +681,20 @@ export function importDataToStore(source: string, data: string, store: Store) {
}
const {serial, deviceType, title, os, logs} = device;
const archivedDevice = new ArchivedDevice(
const archivedDevice = new ArchivedDevice({
serial,
deviceType,
title,
os,
logs
logEntries: logs
? logs.map(l => {
return {...l, date: new Date(l.date)};
})
: [],
deviceScreenshot,
screenshotHandle: deviceScreenshot,
source,
supportRequestDetails,
);
});
const devices = store.getState().connections.devices;
const matchedDevices = devices.filter(
availableDevice => availableDevice.serial === serial,