remove shortcuts
Reviewed By: aigoncharov Differential Revision: D51159922 fbshipit-source-id: fbb59b416f92b9156c74a12247da8d0df07f1a4e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
04b4bf7bdf
commit
d023bcc42e
@@ -29,13 +29,6 @@ export type Settings = {
|
|||||||
*/
|
*/
|
||||||
enablePrefetching: Tristate;
|
enablePrefetching: Tristate;
|
||||||
idbPath: string;
|
idbPath: string;
|
||||||
reactNative: {
|
|
||||||
shortcuts: {
|
|
||||||
enabled: boolean;
|
|
||||||
reload: string;
|
|
||||||
openDevMenu: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
darkMode: 'dark' | 'light' | 'system';
|
darkMode: 'dark' | 'light' | 'system';
|
||||||
showWelcomeAtStartup: boolean;
|
showWelcomeAtStartup: boolean;
|
||||||
suppressPluginErrors: boolean;
|
suppressPluginErrors: boolean;
|
||||||
|
|||||||
@@ -56,13 +56,6 @@ function getDefaultSettings(): Settings {
|
|||||||
enablePhysicalIOS: os.platform() === 'darwin',
|
enablePhysicalIOS: os.platform() === 'darwin',
|
||||||
enablePrefetching: Tristate.Unset,
|
enablePrefetching: Tristate.Unset,
|
||||||
idbPath: '/usr/local/bin/idb',
|
idbPath: '/usr/local/bin/idb',
|
||||||
reactNative: {
|
|
||||||
shortcuts: {
|
|
||||||
enabled: false,
|
|
||||||
reload: 'Alt+Shift+R',
|
|
||||||
openDevMenu: 'Alt+Shift+D',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
darkMode: 'light',
|
darkMode: 'light',
|
||||||
showWelcomeAtStartup: true,
|
showWelcomeAtStartup: true,
|
||||||
suppressPluginErrors: false,
|
suppressPluginErrors: false,
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
ConfigText,
|
ConfigText,
|
||||||
URLConfigField,
|
URLConfigField,
|
||||||
} from './settings/configFields';
|
} from './settings/configFields';
|
||||||
import KeyboardShortcutInput from './settings/KeyboardShortcutInput';
|
|
||||||
import {isEqual, isMatch, isEmpty} from 'lodash';
|
import {isEqual, isMatch, isEmpty} from 'lodash';
|
||||||
import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
||||||
import {
|
import {
|
||||||
@@ -124,7 +123,6 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
enablePhysicalIOS,
|
enablePhysicalIOS,
|
||||||
enablePrefetching,
|
enablePrefetching,
|
||||||
idbPath,
|
idbPath,
|
||||||
reactNative,
|
|
||||||
darkMode,
|
darkMode,
|
||||||
suppressPluginErrors,
|
suppressPluginErrors,
|
||||||
persistDeviceData,
|
persistDeviceData,
|
||||||
@@ -294,60 +292,6 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
<Radio.Button value="system">Use System Setting</Radio.Button>
|
<Radio.Button value="system">Use System Setting</Radio.Button>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Layout.Container>
|
</Layout.Container>
|
||||||
<ToggledSection
|
|
||||||
label="React Native keyboard shortcuts"
|
|
||||||
toggled={reactNative.shortcuts.enabled}
|
|
||||||
onChange={(enabled) => {
|
|
||||||
this.setState((prevState) => ({
|
|
||||||
updatedSettings: {
|
|
||||||
...prevState.updatedSettings,
|
|
||||||
reactNative: {
|
|
||||||
...prevState.updatedSettings.reactNative,
|
|
||||||
shortcuts: {
|
|
||||||
...prevState.updatedSettings.reactNative.shortcuts,
|
|
||||||
enabled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}}>
|
|
||||||
<KeyboardShortcutInput
|
|
||||||
label="Reload application"
|
|
||||||
value={reactNative.shortcuts.reload}
|
|
||||||
onChange={(reload) => {
|
|
||||||
this.setState((prevState) => ({
|
|
||||||
updatedSettings: {
|
|
||||||
...prevState.updatedSettings,
|
|
||||||
reactNative: {
|
|
||||||
...prevState.updatedSettings.reactNative,
|
|
||||||
shortcuts: {
|
|
||||||
...prevState.updatedSettings.reactNative.shortcuts,
|
|
||||||
reload,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<KeyboardShortcutInput
|
|
||||||
label="Open developer menu"
|
|
||||||
value={reactNative.shortcuts.openDevMenu}
|
|
||||||
onChange={(openDevMenu) => {
|
|
||||||
this.setState((prevState) => ({
|
|
||||||
updatedSettings: {
|
|
||||||
...prevState.updatedSettings,
|
|
||||||
reactNative: {
|
|
||||||
...prevState.updatedSettings.reactNative,
|
|
||||||
shortcuts: {
|
|
||||||
...prevState.updatedSettings.reactNative.shortcuts,
|
|
||||||
openDevMenu,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ToggledSection>
|
|
||||||
<NUX
|
<NUX
|
||||||
// TODO: provide link to Flipper doc with more details
|
// TODO: provide link to Flipper doc with more details
|
||||||
title="Plugin marketplace serve as a way to distribute private/internal plugins"
|
title="Plugin marketplace serve as a way to distribute private/internal plugins"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import notifications from './notifications';
|
|||||||
import plugins from './plugins';
|
import plugins from './plugins';
|
||||||
import user from './fb-stubs/user';
|
import user from './fb-stubs/user';
|
||||||
import pluginManager from './pluginManager';
|
import pluginManager from './pluginManager';
|
||||||
import reactNative from './reactNative';
|
|
||||||
import pluginMarketplace from './pluginMarketplace';
|
import pluginMarketplace from './pluginMarketplace';
|
||||||
import pluginDownloads from './pluginDownloads';
|
import pluginDownloads from './pluginDownloads';
|
||||||
import info from '../utils/info';
|
import info from '../utils/info';
|
||||||
@@ -39,7 +38,6 @@ export default async function (
|
|||||||
plugins,
|
plugins,
|
||||||
user,
|
user,
|
||||||
pluginManager,
|
pluginManager,
|
||||||
reactNative,
|
|
||||||
pluginMarketplace,
|
pluginMarketplace,
|
||||||
pluginDownloads,
|
pluginDownloads,
|
||||||
info,
|
info,
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {Store} from '../reducers';
|
|
||||||
import {registerShortcut} from '../utils/registerShortcut';
|
|
||||||
|
|
||||||
type ShortcutEventCommand =
|
|
||||||
| {
|
|
||||||
shortcut: string;
|
|
||||||
command: string;
|
|
||||||
}
|
|
||||||
| '';
|
|
||||||
|
|
||||||
export default (store: Store) => {
|
|
||||||
const settings = store.getState().settingsState.reactNative;
|
|
||||||
|
|
||||||
if (!settings?.shortcuts.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const shortcuts: ShortcutEventCommand[] = [
|
|
||||||
settings.shortcuts.reload && {
|
|
||||||
shortcut: settings.shortcuts.reload,
|
|
||||||
command: 'reload',
|
|
||||||
},
|
|
||||||
settings.shortcuts.openDevMenu && {
|
|
||||||
shortcut: settings.shortcuts.openDevMenu,
|
|
||||||
command: 'devMenu',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
shortcuts.forEach(
|
|
||||||
(shortcut: ShortcutEventCommand) =>
|
|
||||||
shortcut &&
|
|
||||||
shortcut.shortcut &&
|
|
||||||
registerShortcut(shortcut.shortcut, () => {
|
|
||||||
const devices = store
|
|
||||||
.getState()
|
|
||||||
.connections.devices.filter(
|
|
||||||
(device) => device.os === 'Metro' && !device.isArchived,
|
|
||||||
);
|
|
||||||
|
|
||||||
devices.forEach((device) =>
|
|
||||||
device.flipperServer.exec(
|
|
||||||
'metro-command',
|
|
||||||
device.serial,
|
|
||||||
shortcut.command,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -184,9 +184,6 @@ function createStubRenderHost(): RenderHost {
|
|||||||
enablePhysicalIOS: false,
|
enablePhysicalIOS: false,
|
||||||
enablePrefetching: Tristate.False,
|
enablePrefetching: Tristate.False,
|
||||||
idbPath: `/dev/null`,
|
idbPath: `/dev/null`,
|
||||||
reactNative: {
|
|
||||||
shortcuts: {enabled: false, openDevMenu: '', reload: ''},
|
|
||||||
},
|
|
||||||
showWelcomeAtStartup: false,
|
showWelcomeAtStartup: false,
|
||||||
suppressPluginErrors: false,
|
suppressPluginErrors: false,
|
||||||
persistDeviceData: false,
|
persistDeviceData: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user