Killed Flipper headless
Reviewed By: nikoant Differential Revision: D24160480 fbshipit-source-id: 221e60473dddc0a49cea674e210beb6f85b1b03c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
41a1af33cb
commit
08b5644253
@@ -14,14 +14,11 @@ import Text from '../ui/components/FlexRow';
|
||||
import Glyph from '../ui/components/Glyph';
|
||||
import {colors, brandColors} from '../ui/components/colors';
|
||||
import isProduction from '../utils/isProduction';
|
||||
import isHeadless from '../utils/isHeadless';
|
||||
import constants from '../fb-stubs/constants';
|
||||
const {shell, remote} = !isHeadless()
|
||||
? require('electron')
|
||||
: {shell: undefined, remote: undefined};
|
||||
import {shell, remote} from 'electron';
|
||||
import {PureComponent} from 'react';
|
||||
import React from 'react';
|
||||
import {Tracked, TrackingScope} from 'flipper-plugin';
|
||||
import {Logger, Tracked, TrackingScope} from 'flipper-plugin';
|
||||
|
||||
const Container = styled(FlexColumn)({
|
||||
height: '100%',
|
||||
@@ -95,7 +92,9 @@ const Logo = styled.img({
|
||||
marginBottom: 20,
|
||||
});
|
||||
|
||||
type Props = {};
|
||||
type Props = {
|
||||
logger: Logger;
|
||||
};
|
||||
type State = {
|
||||
isMounted: boolean;
|
||||
};
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export class WelcomeScreenHeadless {
|
||||
// NoOp
|
||||
}
|
||||
@@ -56,6 +56,7 @@ import {
|
||||
NoDevices,
|
||||
getColorByApp,
|
||||
getFavoritePlugins,
|
||||
isStaticViewActive,
|
||||
} from './sidebarUtils';
|
||||
import {useLocalStorage} from '../../utils/useLocalStorage';
|
||||
import {PluginDefinition, ClientPluginMap, DevicePluginMap} from '../../plugin';
|
||||
@@ -391,13 +392,6 @@ class MainSidebar2 extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
function isStaticViewActive(
|
||||
current: StaticView,
|
||||
selected: StaticView,
|
||||
): boolean {
|
||||
return current && selected && current === selected;
|
||||
}
|
||||
|
||||
function groupPluginsByCategory(
|
||||
plugins: FlipperPlugins,
|
||||
): PluginsByCategoryType {
|
||||
|
||||
@@ -116,7 +116,7 @@ export function isStaticViewActive(
|
||||
current: StaticView,
|
||||
selected: StaticView,
|
||||
): boolean {
|
||||
return current && selected && current === selected;
|
||||
return Boolean(current && selected && current === selected);
|
||||
}
|
||||
|
||||
export const CategoryName = styled(PluginName)({
|
||||
|
||||
@@ -11,7 +11,6 @@ import {Store} from '../reducers/index';
|
||||
import {Logger} from '../fb-interfaces/Logger';
|
||||
import {PluginNotification} from '../reducers/notifications';
|
||||
import {PluginDefinition, isSandyPlugin} from '../plugin';
|
||||
import isHeadless from '../utils/isHeadless';
|
||||
import {setStaticView} from '../reducers/connections';
|
||||
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
||||
import {
|
||||
@@ -158,7 +157,6 @@ export default (store: Store, logger: Logger) => {
|
||||
}))
|
||||
.forEach((n: PluginNotification) => {
|
||||
if (
|
||||
!isHeadless() &&
|
||||
store.getState().connections.selectedPlugin !== 'notifications' &&
|
||||
!knownNotifications.has(n.notification.id) &&
|
||||
blocklistedPlugins.indexOf(n.pluginId) === -1 &&
|
||||
|
||||
@@ -10,6 +10,5 @@
|
||||
export {LogTypes, TrackType, Logger} from 'flipper-plugin';
|
||||
|
||||
export type Args = {
|
||||
isHeadless?: boolean;
|
||||
isTest?: boolean;
|
||||
};
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
|
||||
import React, {Component} from 'react';
|
||||
import {StaticViewProps} from '../reducers/connections';
|
||||
import {Text} from '../ui';
|
||||
|
||||
export default class extends Component<void, void> {
|
||||
export default class extends Component<StaticViewProps, {}> {
|
||||
render() {
|
||||
return <Text>Build your support request deteails form.</Text>;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
|
||||
import React, {Component} from 'react';
|
||||
import {StaticViewProps} from '../reducers/connections';
|
||||
import {Text} from '../ui';
|
||||
|
||||
export default class extends Component<void, void> {
|
||||
export default class extends Component<StaticViewProps, {}> {
|
||||
render() {
|
||||
return <Text>Build your support request creation form.</Text>;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
|
||||
import React, {Component} from 'react';
|
||||
import {StaticViewProps} from '../reducers/connections';
|
||||
import {Text} from '../ui';
|
||||
|
||||
export default class extends Component<void, void> {
|
||||
export default class extends Component<StaticViewProps, {}> {
|
||||
render() {
|
||||
return <Text>Debug Videos on Watch Bugs.</Text>;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {ComponentType} from 'react';
|
||||
import {produce} from 'immer';
|
||||
|
||||
import type BaseDevice from '../devices/BaseDevice';
|
||||
@@ -15,28 +16,18 @@ import type Client from '../Client';
|
||||
import {UninitializedClient} from '../UninitializedClient';
|
||||
import {isEqual} from 'lodash';
|
||||
import {performance} from 'perf_hooks';
|
||||
import isHeadless from '../utils/isHeadless';
|
||||
import {Actions} from '.';
|
||||
const WelcomeScreen = isHeadless()
|
||||
? require('../chrome/WelcomeScreenHeadless').default
|
||||
: require('../chrome/WelcomeScreen').default;
|
||||
import NotificationScreen from '../chrome/NotificationScreen';
|
||||
import SupportRequestFormV2 from '../fb-stubs/SupportRequestFormV2';
|
||||
import SupportRequestDetails from '../fb-stubs/SupportRequestDetails';
|
||||
import WelcomeScreen from '../chrome/WelcomeScreen';
|
||||
import {getPluginKey, isDevicePluginDefinition} from '../utils/pluginUtils';
|
||||
import {deconstructClientId} from '../utils/clientUtils';
|
||||
import {PluginDefinition} from '../plugin';
|
||||
import {RegisterPluginAction} from './plugins';
|
||||
import {ConsoleLogs} from '../chrome/ConsoleLogs';
|
||||
import MetroDevice from '../devices/MetroDevice';
|
||||
import {Logger} from 'flipper-plugin';
|
||||
|
||||
export type StaticView =
|
||||
| null
|
||||
| typeof WelcomeScreen
|
||||
| typeof NotificationScreen
|
||||
| typeof SupportRequestFormV2
|
||||
| typeof SupportRequestDetails
|
||||
| typeof ConsoleLogs;
|
||||
export type StaticViewProps = {logger: Logger};
|
||||
|
||||
export type StaticView = null | ComponentType<StaticViewProps>;
|
||||
|
||||
export type State = {
|
||||
devices: Array<BaseDevice>;
|
||||
|
||||
@@ -309,8 +309,7 @@ function ShowSettingsButton() {
|
||||
function SupportFormButton() {
|
||||
const dispatch = useDispatch();
|
||||
const staticView = useStore((state) => state.connections.staticView);
|
||||
// const isVisible =
|
||||
return (
|
||||
return config.isFBBuild ? (
|
||||
<LeftRailButton
|
||||
icon={<BugOutlined />}
|
||||
small
|
||||
@@ -324,7 +323,7 @@ function SupportFormButton() {
|
||||
dispatch(setStaticView(SupportRequestFormV2));
|
||||
}}
|
||||
/>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
||||
function WelcomeScreenButton() {
|
||||
|
||||
@@ -127,7 +127,7 @@ export function SandyApp() {
|
||||
{staticView ? (
|
||||
<TrackingScope
|
||||
scope={
|
||||
staticView.displayName ??
|
||||
(staticView as any).displayName ??
|
||||
staticView.name ??
|
||||
staticView.constructor?.name ??
|
||||
'unknown static view'
|
||||
|
||||
@@ -22,10 +22,7 @@ const {Text, Title} = Typography;
|
||||
|
||||
import constants from '../fb-stubs/constants';
|
||||
import isProduction from '../utils/isProduction';
|
||||
import isHeadless from '../utils/isHeadless';
|
||||
const {shell, remote} = !isHeadless()
|
||||
? require('electron')
|
||||
: {shell: undefined, remote: undefined};
|
||||
import {shell, remote} from 'electron';
|
||||
|
||||
const RowContainer = styled(FlexRow)({
|
||||
alignItems: 'flex-start',
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export default function isHeadless(): boolean {
|
||||
return typeof global.window === 'undefined';
|
||||
}
|
||||
Reference in New Issue
Block a user