Support Installation for physical device

Summary: This diff enables the installation for iOS simulators. This also fixes the error view created when there is an error. Right now there is a bug on my machine where idb doesn't detect my physical device. But once it is detected, it will work.

Reviewed By: mweststrate

Differential Revision: D22137831

fbshipit-source-id: b6d6f77318c6baef78c35af73db3969b7dd1b907
This commit is contained in:
Pritesh Nandgaonkar
2020-06-22 15:56:40 -07:00
committed by Facebook GitHub Bot
parent 2d9d2d4b1a
commit d4680eead9
4 changed files with 10 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import {
import React, {PureComponent} from 'react'; import React, {PureComponent} from 'react';
import {connect, ReactReduxContext} from 'react-redux'; import {connect, ReactReduxContext} from 'react-redux';
import {setPluginState} from './reducers/pluginStates'; import {setPluginState} from './reducers/pluginStates';
import {Settings} from './reducers/settings';
import {selectPlugin} from './reducers/connections'; import {selectPlugin} from './reducers/connections';
import {State as Store, MiddlewareAPI} from './reducers/index'; import {State as Store, MiddlewareAPI} from './reducers/index';
import {activateMenuItems} from './MenuBar'; import {activateMenuItems} from './MenuBar';
@@ -44,7 +45,6 @@ import {Message} from './reducers/pluginMessageQueue';
import {Idler} from './utils/Idler'; import {Idler} from './utils/Idler';
import {processMessageQueue} from './utils/messageQueue'; import {processMessageQueue} from './utils/messageQueue';
import {ToggleButton, SmallText} from './ui'; import {ToggleButton, SmallText} from './ui';
import debounceRender from 'react-debounce-render';
const Container = styled(FlexColumn)({ const Container = styled(FlexColumn)({
width: 0, width: 0,
@@ -103,6 +103,7 @@ type StateFromProps = {
isArchivedDevice: boolean; isArchivedDevice: boolean;
pendingMessages: Message[] | undefined; pendingMessages: Message[] | undefined;
pluginIsEnabled: boolean; pluginIsEnabled: boolean;
settingsState: Settings;
}; };
type DispatchFromProps = { type DispatchFromProps = {
@@ -321,6 +322,7 @@ class PluginContainer extends PureComponent<Props, State> {
target, target,
isArchivedDevice, isArchivedDevice,
selectedApp, selectedApp,
settingsState,
} = this.props; } = this.props;
if (!activePlugin || !target || !pluginKey) { if (!activePlugin || !target || !pluginKey) {
console.warn(`No selected plugin. Rendering empty!`); console.warn(`No selected plugin. Rendering empty!`);
@@ -339,6 +341,7 @@ class PluginContainer extends PureComponent<Props, State> {
key: pluginKey, key: pluginKey,
logger: this.props.logger, logger: this.props.logger,
selectedApp, selectedApp,
settingsState,
persistedState: activePlugin.defaultPersistedState persistedState: activePlugin.defaultPersistedState
? { ? {
...activePlugin.defaultPersistedState, ...activePlugin.defaultPersistedState,
@@ -397,6 +400,7 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
pluginStates, pluginStates,
plugins: {devicePlugins, clientPlugins}, plugins: {devicePlugins, clientPlugins},
pluginMessageQueue, pluginMessageQueue,
settingsState,
}) => { }) => {
let pluginKey = null; let pluginKey = null;
let target = null; let target = null;
@@ -447,6 +451,7 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
selectedApp: selectedApp || null, selectedApp: selectedApp || null,
pendingMessages, pendingMessages,
pluginIsEnabled, pluginIsEnabled,
settingsState,
}; };
return s; return s;
}, },

View File

@@ -192,6 +192,6 @@ export {Logger} from './fb-interfaces/Logger';
export {getInstance as getLogger} from './fb-stubs/Logger'; export {getInstance as getLogger} from './fb-stubs/Logger';
export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils'; export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils';
export {useLocalStorage} from './utils/useLocalStorage'; export {useLocalStorage} from './utils/useLocalStorage';
export {checkIdbIsInstalled} from './utils/iOSContainerUtility';
// Sidebar extensions should be last so they can import anything from here. // Sidebar extensions should be last so they can import anything from here.
export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions'; export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions';

View File

@@ -21,6 +21,7 @@ import {StaticView} from './reducers/connections';
import {State as ReduxState} from './reducers'; import {State as ReduxState} from './reducers';
import {DEFAULT_MAX_QUEUE_SIZE} from './reducers/pluginMessageQueue'; import {DEFAULT_MAX_QUEUE_SIZE} from './reducers/pluginMessageQueue';
import {PluginDetails} from 'flipper-plugin-lib'; import {PluginDetails} from 'flipper-plugin-lib';
import {Settings} from './reducers/settings';
type Parameters = {[key: string]: any}; type Parameters = {[key: string]: any};
// This function is intended to be called from outside of the plugin. // This function is intended to be called from outside of the plugin.
@@ -74,6 +75,7 @@ export type Props<T> = {
isArchivedDevice: boolean; isArchivedDevice: boolean;
selectedApp: string | null; selectedApp: string | null;
setStaticView: (payload: StaticView) => void; setStaticView: (payload: StaticView) => void;
settingsState: Settings;
}; };
export type BaseAction = { export type BaseAction = {

View File

@@ -107,7 +107,7 @@ async function pull(
); );
} }
async function checkIdbIsInstalled(idbPath: string): Promise<void> { export async function checkIdbIsInstalled(idbPath: string): Promise<void> {
const isInstalled = await isAvailable(idbPath); const isInstalled = await isAvailable(idbPath);
if (!isInstalled) { if (!isInstalled) {
throw new Error( throw new Error(