Skip to content

Commit e16b647

Browse files
motiz88facebook-github-bot
authored andcommitted
Backout D82236159: [RN][debugger-shell] Implement saved window positioning per target (#53816)
Summary: Pull Request resolved: #53816 Changelog: [Internal] D82236159 introduced the first `node_modules` dependency in the Electron part of `react-native/debugger-shell`. This is not currently handled correctly by the build script, so this resulted in an instacrashing binary. I'm temporarily backing out D82236159 until we have a proper fix for the build script. Reviewed By: robhogan Differential Revision: D82632937 fbshipit-source-id: 6c7c182e2a7c89e6ea2761096dcc426dbf2ae5cb
1 parent cb7453f commit e16b647

4 files changed

Lines changed: 13 additions & 242 deletions

File tree

flow-typed/npm/electron-store_v8.x.x.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

packages/debugger-shell/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
},
3636
"devDependencies": {
3737
"electron": "37.2.6",
38-
"electron-store": "^8.2.0",
3938
"semver": "^7.1.3"
4039
},
4140
"files": [

packages/debugger-shell/src/electron/MainInstanceEntryPoint.js

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010

1111
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
1212
const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any;
13-
const Store = require('electron-store');
1413
const path = require('path');
1514
const util = require('util');
1615

17-
const appSettings = new Store();
1816
const windowMetadata = new WeakMap<
1917
typeof BrowserWindow,
2018
$ReadOnly<{
@@ -55,11 +53,10 @@ function handleLaunchArgs(argv: string[]) {
5553
}, 1000);
5654
}
5755
} else {
56+
// Create the browser window.
5857
frontendWindow = new BrowserWindow({
59-
...(getSavedWindowPosition(windowKey) ?? {
60-
width: 1200,
61-
height: 600,
62-
}),
58+
width: 1200,
59+
height: 600,
6360
webPreferences: {
6461
partition: 'persist:react-native-devtools',
6562
preload: require.resolve('./preload.js'),
@@ -69,8 +66,6 @@ function handleLaunchArgs(argv: string[]) {
6966
});
7067
// Auto-hide the Windows/Linux menu bar
7168
frontendWindow.setMenuBarVisibility(false);
72-
// Observe and update saved window position
73-
setupWindowResizeListeners(frontendWindow, windowKey);
7469
}
7570

7671
// Open links in the default browser instead of in new Electron windows.
@@ -124,37 +119,6 @@ function configureAppMenu() {
124119
Menu.setApplicationMenu(menu);
125120
}
126121

127-
function getSavedWindowPosition(
128-
windowKey: string,
129-
): ?{width: number, height: number, x?: number, y?: number} {
130-
return appSettings.get('windowArrangements', {})[windowKey];
131-
}
132-
133-
function saveWindowPosition(
134-
windowKey: string,
135-
position: {x: number, y: number, width: number, height: number},
136-
) {
137-
const windowArrangements = appSettings.get('windowArrangements', {});
138-
windowArrangements[windowKey] = position;
139-
appSettings.set('windowArrangements', windowArrangements);
140-
}
141-
142-
function setupWindowResizeListeners(
143-
browserWindow: typeof BrowserWindow,
144-
windowKey: string,
145-
) {
146-
const savePosition = () => {
147-
if (!browserWindow.isDestroyed()) {
148-
const [x, y] = browserWindow.getPosition();
149-
const [width, height] = browserWindow.getSize();
150-
saveWindowPosition(windowKey, {x, y, width, height});
151-
}
152-
};
153-
browserWindow.on('moved', savePosition);
154-
browserWindow.on('resized', savePosition);
155-
browserWindow.on('closed', savePosition);
156-
}
157-
158122
app.whenReady().then(() => {
159123
handleLaunchArgs(process.argv.slice(app.isPackaged ? 1 : 2));
160124
configureAppMenu();

0 commit comments

Comments
 (0)