Skip to content

Commit 260eec6

Browse files
committed
fix: fixes #448 Theming not OK Windows 11
Signed-off-by: Pawel Psztyc <[email protected]>
1 parent b8c8a64 commit 260eec6

23 files changed

+2242
-1709
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"advancedrestclient",
55
"appresources",
66
"arccontextmenu",
7+
"asar",
78
"autoupdate",
89
"camelcase",
910
"codemirror",

package-lock.json

Lines changed: 1523 additions & 1666 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@types/uuid": "^8.3.1",
6161
"chai": "^4.3.4",
6262
"chance": "^1.1.8",
63-
"dotenv": "^15.0.0",
63+
"dotenv": "^16.0.0",
6464
"electron": "^17.0.0",
6565
"electron-builder": "^22.13.1",
6666
"electron-builder-notarize": "^1.2.0",
@@ -77,7 +77,7 @@
7777
"pouchdb": "^7.2.2",
7878
"rimraf": "^3.0.2",
7979
"sinon": "^13.0.0",
80-
"spectron": "^15.0.0",
80+
"spectron": "^19.0.0",
8181
"typescript": "^4.4.4",
8282
"typescript-lit-html-plugin": "^0.9.0"
8383
},
@@ -86,7 +86,7 @@
8686
"@advanced-rest-client/events": "^0.2.31",
8787
"@api-components/amf-web-api": "^0.1.1",
8888
"camelcase": "^6.2.0",
89-
"electron-log": "^4.4.1",
89+
"electron-log": "^4.4.6",
9090
"electron-prompt": "^1.7.0",
9191
"electron-updater": "^4.3.9",
9292
"esm": "^3.2.25",

src/io/AmfParserConnector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export class AmfParserConnector {
2727
ipcMain.handle('amf-parser', this.ipcHandler.bind(this));
2828
}
2929

30+
unlisten() {
31+
ipcMain.removeHandler('amf-parser');
32+
}
33+
3034
/**
3135
* @param {Electron.IpcMainEvent} e
3236
* @param {string} action The action to perform.

src/io/AppPrompts.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export class AppPrompts {
1717
ipcMain.handle('open-dialog', this[openDialogHandler].bind(this));
1818
}
1919

20+
unlisten() {
21+
ipcMain.removeHandler('save-dialog');
22+
ipcMain.removeHandler('open-dialog');
23+
}
24+
2025
/**
2126
* Handles save action dialog. Opens "save as..." dialog and returns the result to the app.
2227
*

src/io/AppStateManager.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export class AppStateManager extends ArcPreferences {
3333
ipcMain.handle('app-state-update', this[changeHandler]);
3434
}
3535

36+
unlisten() {
37+
ipcMain.removeHandler('app-state-read');
38+
ipcMain.removeHandler('app-state-update');
39+
}
40+
3641
async [readHandler]() {
3742
let data;
3843
try {

src/io/ApplicationDefaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ThemeDefaults } from './defaults/ThemeDefaults.js';
1+
import { ThemeDefaults } from './defaults/ThemeDefaultsNew.js';
22
import { WorkspaceDefaults } from './defaults/WorkspaceDefaults.js';
33
import { DataStore } from './defaults/DataStore.js';
44

src/io/ApplicationMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class ApplicationMenu extends EventEmitter {
6565
async getTemplate() {
6666
const osName = this.platformToName();
6767
const name = `${osName}.json`;
68-
const file = path.join(__dirname, '..', 'menus', name);
68+
const file = path.join(app.getAppPath(), 'src', 'menus', name);
6969
logger.debug(`Menu template location: ${file}`);
7070
return fs.readJson(file);
7171
}

src/io/ApplicationUpdater.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { autoUpdater } from 'electron-updater';
22
import { EventEmitter } from 'events';
3-
import { dialog, nativeImage, ipcMain, BrowserWindow } from 'electron';
3+
import { dialog, nativeImage, ipcMain, BrowserWindow, app } from 'electron';
44
import path from 'path';
55
import { logger } from './Logger.js';
66

@@ -257,7 +257,7 @@ export class ApplicationUpdater extends EventEmitter {
257257
detail,
258258
};
259259
if (!isError) {
260-
const imgPath = path.join(__dirname, '..', '..', 'assets', 'icon.iconset', 'icon_512x512.png');
260+
const imgPath = path.join(app.getAppPath(), 'assets', 'icon.iconset', 'icon_512x512.png');
261261
dialogOpts.icon = nativeImage.createFromPath(imgPath);
262262
}
263263
dialog.showMessageBox(dialogOpts);

src/io/ArcEnvironment.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,31 @@ export class ArcEnvironment {
303303
logger.debug('All windows are now closed.');
304304
// https://github.com/advanced-rest-client/arc-electron/issues/396
305305
logger.debug('Quitting the IO thread.');
306-
app.quit();
307-
// if (process.platform !== 'darwin') {
308-
// logger.debug('Quitting main thread.');
309-
// } else {
310-
// logger.debug('Keeping main thread running.');
311-
// }
306+
this.destruct();
307+
// app.quit();
308+
app.exit();
312309
}, 1000);
313310
}
314311

312+
destruct() {
313+
app.removeAllListeners('activate');
314+
app.removeAllListeners('window-all-closed');
315+
this.wm.unlisten();
316+
this.themes.unlisten();
317+
this.sm.unlisten();
318+
this.proxy.unlisten();
319+
this.config.unlisten();
320+
this.appMenuService.unlisten();
321+
this.osHosts.unlisten();
322+
this.gDrive.unlisten();
323+
this.externalResources.unlisten();
324+
this.search.unlisten();
325+
this.state.unlisten();
326+
this.prompts.unlisten();
327+
this.updater.unlisten();
328+
this.amf.unlisten();
329+
}
330+
315331
/**
316332
* On OS X it's common to re-create a window in the app when the
317333
* dock icon is clicked and there are no other windows open.

0 commit comments

Comments
 (0)