Alpha 1.6.0-2 resolving white screen on built load.
This commit is contained in:
@@ -8,6 +8,8 @@ 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";
|
||||
|
||||
//const Nucleus = require("nucleus-nodejs");
|
||||
require("./ipc-main-handler");
|
||||
require("./analytics");
|
||||
@@ -103,6 +105,17 @@ var menu = Menu.buildFromTemplate([
|
||||
shell.openPath(path.join(app.getPath("appData"), "ImeX RPS\\logs"));
|
||||
}
|
||||
},
|
||||
...(enableDevTools
|
||||
? [
|
||||
{
|
||||
label: "Toggle DevTools",
|
||||
accelerator: "CmdOrCtrl+Alt+I",
|
||||
click() {
|
||||
if (mainWindow) mainWindow.webContents.toggleDevTools();
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "Third Party Notices",
|
||||
click() {
|
||||
@@ -116,16 +129,22 @@ var menu = Menu.buildFromTemplate([
|
||||
let mainWindow;
|
||||
let noticeWindow;
|
||||
let tray = null;
|
||||
contextMenu({ showInspectElement: false });
|
||||
contextMenu({ showInspectElement: enableDevTools });
|
||||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
Menu.setApplicationMenu(menu);
|
||||
|
||||
const appPath = app.getAppPath();
|
||||
const preloadPath = isDev
|
||||
? path.join(appPath, "electron", "preload-src.js")
|
||||
: path.join(appPath, "dist-electron", "preload.cjs");
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
// width: 800,
|
||||
// height: 600,
|
||||
title: `ImEX RPS ${app.getVersion()}`,
|
||||
icon: path.join(__dirname, "../src/assets/logo192.png"),
|
||||
icon: path.join(appPath, "src", "assets", "logo192.png"),
|
||||
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
@@ -133,8 +152,8 @@ function createWindow() {
|
||||
webSecurity: true,
|
||||
worldSafeExecuteJavaScript: true,
|
||||
contextIsolation: true,
|
||||
devTools: isDev,
|
||||
preload: path.join(__dirname, "preload.js") // use a preload script
|
||||
devTools: enableDevTools,
|
||||
preload: preloadPath // use a preload script
|
||||
}
|
||||
});
|
||||
|
||||
@@ -154,7 +173,12 @@ function createWindow() {
|
||||
|
||||
// and load the index.html of the app.
|
||||
// win.loadFile("index.html");
|
||||
mainWindow.loadURL(isDev ? "http://localhost:3000" : `file://${path.join(__dirname, "/../build/index.html")}`);
|
||||
if (isDev) {
|
||||
mainWindow.loadURL("http://localhost:3000");
|
||||
} else {
|
||||
const indexPath = path.join(appPath, "build", "index.html");
|
||||
mainWindow.loadFile(indexPath);
|
||||
}
|
||||
|
||||
// mainWindow.on("close", function (event) {
|
||||
// event.preventDefault();
|
||||
@@ -177,19 +201,22 @@ function createWindow() {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
// Open the DevTools.
|
||||
if (isDev) {
|
||||
// Open the DevTools when explicitly enabled.
|
||||
if (enableDevTools) {
|
||||
mainWindow.webContents.openDevTools({
|
||||
// mode: "detach"
|
||||
mode: "detach"
|
||||
});
|
||||
}
|
||||
|
||||
mainWindow.maximize();
|
||||
|
||||
if (isDev) {
|
||||
if (enableDevTools) {
|
||||
globalShortcut.register("CommandOrControl+Shift+I", () => {
|
||||
mainWindow.webContents.toggleDevTools();
|
||||
});
|
||||
globalShortcut.register("CommandOrControl+Alt+I", () => {
|
||||
mainWindow.webContents.toggleDevTools();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,7 +267,8 @@ app.on("activate", () => {
|
||||
});
|
||||
|
||||
function createTray() {
|
||||
let appIcon = new Tray(path.join(__dirname, "../src/assets/logo192.png"));
|
||||
const appPath = app.getAppPath();
|
||||
let appIcon = new Tray(path.join(appPath, "src", "assets", "logo192.png"));
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: "Show",
|
||||
@@ -288,11 +316,12 @@ function openNoticeWindow() {
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
devTools: isDev
|
||||
devTools: enableDevTools
|
||||
}
|
||||
});
|
||||
|
||||
noticeWindow.loadURL(`file://${path.join(__dirname, "licenses.txt")}`);
|
||||
const appPath = app.getAppPath();
|
||||
noticeWindow.loadURL(`file://${path.join(appPath, "electron", "licenses.txt")}`);
|
||||
noticeWindow.on("closed", () => {
|
||||
noticeWindow = null;
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"productName": "ImEX RPS",
|
||||
"author": "ImEX Systems Inc. <support@thinkimex.com>",
|
||||
"description": "ImEX RPS",
|
||||
"version": "1.6.0-alpha.1",
|
||||
"version": "1.6.0-alpha.2",
|
||||
"main": "electron/main.js",
|
||||
"homepage": "./",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user