Be able to select Metro plugins

Summary:
This adds the ability in AppInspect to work with Metro and plugins.

Metro remains a weird and hardcoded edge case, as we show it as part of another device. So a few things to notice:
- Metro does not have it's own entry in the device/app dropdown
- When selecting a metro plugin, the surrounding context (selected main device / app) remains, but you will notice that the device dropdown switches to 'React Native'. This is intentional to reflect that we are talking to React Native in general, and not necessarily to the device / app shown in the context.

Reviewed By: nikoant

Differential Revision: D24422267

fbshipit-source-id: 239aa71b5c01e19bdda53a930ad9fa8af13b8d4a
This commit is contained in:
Michel Weststrate
2020-10-22 09:37:26 -07:00
committed by Facebook GitHub Bot
parent 8a7323b9f8
commit c55be74426
2 changed files with 63 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ import {deconstructClientId} from '../utils/clientUtils';
import {PluginDefinition} from '../plugin';
import {RegisterPluginAction} from './plugins';
import {ConsoleLogs} from '../chrome/ConsoleLogs';
import MetroDevice from '../devices/MetroDevice';
export type StaticView =
| null
@@ -133,7 +134,7 @@ export type Action =
};
const DEFAULT_PLUGIN = 'DeviceLogs';
const DEFAULT_DEVICE_BLACKLIST = [MacDevice];
const DEFAULT_DEVICE_BLACKLIST = [MacDevice, MetroDevice];
const INITAL_STATE: State = {
devices: [],
androidEmulators: [],
@@ -268,9 +269,10 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
selectedPlugin,
userPreferredPlugin: selectedPlugin || state.userPreferredPlugin,
selectedDevice: selectedDevice!,
userPreferredDevice: selectedDevice
? selectedDevice.title
: state.userPreferredDevice,
userPreferredDevice:
selectedDevice && canBeDefaultDevice(selectedDevice)
? selectedDevice.title
: state.userPreferredDevice,
deepLinkPayload: deepLinkPayload,
});
}