Add MacDevice

Summary:
Add a desktop device on MacOS similar to WindowsDevice (see D8861986).
This makes it possible to view Oculus Service Log files on MacOS too.

Reviewed By: danielbuechele

Differential Revision: D15147501

fbshipit-source-id: 8a076964e6111bf3786818b7cbd8bb7f81c1498d
This commit is contained in:
Zoltán Gilián
2019-04-30 07:14:54 -07:00
committed by Facebook Github Bot
parent 8ba4feba66
commit d9bb1c5cf1
4 changed files with 33 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ export type DeviceExport = {|
logs: Array<DeviceLogEntry>, logs: Array<DeviceLogEntry>,
|}; |};
export type OS = 'iOS' | 'Android' | 'Windows'; export type OS = 'iOS' | 'Android' | 'Windows' | 'MacOS';
export default class BaseDevice { export default class BaseDevice {
constructor(serial: string, deviceType: DeviceType, title: string) { constructor(serial: string, deviceType: DeviceType, title: string) {

22
src/devices/MacDevice.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* Copyright 2018-present Facebook.
* 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.js';
export default class MacDevice extends BaseDevice {
os = 'MacOS';
constructor() {
super('', 'physical', 'desktop');
}
teardown() {}
supportedColumns(): Array<string> {
return [];
}
}

View File

@@ -8,14 +8,20 @@
import type {Store} from '../reducers/index.js'; import type {Store} from '../reducers/index.js';
import type {Logger} from '../fb-interfaces/Logger.js'; import type {Logger} from '../fb-interfaces/Logger.js';
import MacDevice from '../devices/MacDevice';
import WindowsDevice from '../devices/WindowsDevice'; import WindowsDevice from '../devices/WindowsDevice';
export default (store: Store, logger: Logger) => { export default (store: Store, logger: Logger) => {
if (process.platform !== 'win32') { var device;
if (process.platform === 'darwin') {
device = new MacDevice();
} else if (process.platform === 'win32') {
device = new WindowsDevice();
} else {
return; return;
} }
store.dispatch({ store.dispatch({
type: 'REGISTER_DEVICE', type: 'REGISTER_DEVICE',
payload: new WindowsDevice(), payload: device,
}); });
}; };

View File

@@ -7,7 +7,7 @@
import androidDevice from './androidDevice'; import androidDevice from './androidDevice';
import iOSDevice from './iOSDevice'; import iOSDevice from './iOSDevice';
import windowsDevice from './windowsDevice'; import desktopDevice from './desktopDevice';
import application from './application'; import application from './application';
import tracking from './tracking'; import tracking from './tracking';
import server from './server'; import server from './server';
@@ -23,7 +23,7 @@ export default (store: Store, logger: Logger) =>
application, application,
androidDevice, androidDevice,
iOSDevice, iOSDevice,
windowsDevice, desktopDevice,
tracking, tracking,
server, server,
notifications, notifications,