feature/IO-3725-RPS-Changes - Deprecations / Bug fixes

This commit is contained in:
Dave
2026-05-28 14:41:59 -04:00
parent ebf81778c1
commit b6cd010409
8 changed files with 970 additions and 589 deletions

View File

@@ -1,7 +1,6 @@
const { ipcMain, dialog } = require("electron");
const { ipcMain, dialog, BrowserWindow } = require("electron");
const ipcTypes = require("../../src/ipc.types.commonjs");
const { mainWindow } = require("../main");
const _ = require("lodash");
const { store } = require("../electron-store");
const path = require("path");
@@ -9,7 +8,8 @@ var xlsx = require("node-xlsx");
const log = require("electron-log");
ipcMain.on(ipcTypes.default.audit.toMain.browseForFile, async (event, { sheetName }) => {
const result = await dialog.showOpenDialog(mainWindow, {
const parentWindow = BrowserWindow.fromWebContents(event.sender);
const result = await dialog.showOpenDialog(parentWindow, {
filters: [{ extensions: ["xls", "xlsx"], name: "Excel Files" }],
properties: ["openFile"]
});

View File

@@ -1,7 +1,6 @@
const { ipcMain, dialog } = require("electron");
const { ipcMain, dialog, BrowserWindow } = require("electron");
const { StartWatcher, StopWatcher } = require("./file-watcher");
const ipcTypes = require("../../src/ipc.types.commonjs");
const { mainWindow } = require("../main");
const _ = require("lodash");
const { store } = require("../electron-store");
const path = require("path");
@@ -34,7 +33,8 @@ ipcMain.on(ipcTypes.default.fileWatcher.toMain.stop, async (event, arg) => {
});
ipcMain.on(ipcTypes.default.fileWatcher.toMain.addPath, async (event, arg) => {
const result = await dialog.showOpenDialog(mainWindow, {
const parentWindow = BrowserWindow.fromWebContents(event.sender);
const result = await dialog.showOpenDialog(parentWindow, {
properties: ["openDirectory"],
});

View File

@@ -8,7 +8,9 @@ const log = require("electron-log");
const contextMenu = require("electron-context-menu");
const Sentry = require("@sentry/electron/main");
const enableDevTools = isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1"; // Always enable dev tools (was: isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1")
const enableDevTools = isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1";
const openDevToolsOnStart = enableDevTools && process.env.ELECTRON_OPEN_DEVTOOLS === "1";
const installReactDevTools = process.env.ELECTRON_INSTALL_REACT_DEVTOOLS === "1";
//const Nucleus = require("nucleus-nodejs");
require("./ipc-main-handler");
@@ -16,6 +18,7 @@ require("./analytics");
Sentry.init({
dsn: "https://9840e0f304124299e379d9347e12d2e6@o492140.ingest.sentry.io/4505728058523648",
ipcMode: Sentry.IPCMode.Protocol,
ignoreErrors: [
"SimpleURLLoaderWrapper",
"Cannot read properties of null (reading 'webContents')",
@@ -28,9 +31,9 @@ autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = "info";
log.info("App starting...", app.getVersion());
// Conditionally include the dev tools installer to load React Dev Tools
// Conditionally include the dev tools installer to load React DevTools.
let installExtension, REACT_DEVELOPER_TOOLS;
if (isDev) {
if (isDev && installReactDevTools) {
const devTools = require("electron-devtools-installer");
installExtension = devTools.default;
REACT_DEVELOPER_TOOLS = devTools.REACT_DEVELOPER_TOOLS;
@@ -201,8 +204,9 @@ function createWindow() {
app.quit();
});
// Open the DevTools when explicitly enabled.
if (enableDevTools) {
// Open DevTools only when explicitly requested. DevTools itself emits
// Chromium protocol noise such as Autofill.* messages in Electron.
if (openDevToolsOnStart) {
mainWindow.webContents.openDevTools({
// mode: "detach"
});
@@ -221,7 +225,6 @@ function createWindow() {
}
}
exports.mainWindow = mainWindow;
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
@@ -231,9 +234,11 @@ app.whenReady().then(() => {
if (isDev) {
console.log(`Path to Settings File: ${store.path}`);
console.log(`Path to Log File: ${log.log}`);
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((error) => console.log(`An error occurred: , ${error}`));
if (installReactDevTools) {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((error) => console.log(`An error occurred: , ${error}`));
}
}
setInterval(() => {