WIP: showing splash screen

This commit is contained in:
Zamitto
2024-05-18 22:29:11 -03:00
parent 7eee942dcb
commit 484e79dba3
10 changed files with 79 additions and 29 deletions

View File

@@ -7,7 +7,7 @@ import { resolveDatabaseUpdates, WindowManager } from "@main/services";
import { dataSource } from "@main/data-source";
import * as resources from "@locales";
import { userPreferencesRepository } from "@main/repository";
import electronLog from "electron-log";
const { autoUpdater } = updater;
autoUpdater.setFeedURL({
@@ -16,6 +16,9 @@ autoUpdater.setFeedURL({
repo: "hydra",
});
autoUpdater.logger = electronLog;
autoUpdater.logger.transports.file.level = "info";
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) app.quit();
@@ -72,8 +75,8 @@ app.whenReady().then(() => {
autoUpdater.checkForUpdates().then((r) => {
console.log(r);
WindowManager.splashWindow?.close();
WindowManager.createMainWindow();
//WindowManager.splashWindow?.close();
//WindowManager.createMainWindow();
});
});
});

View File

@@ -41,42 +41,25 @@ export class WindowManager {
// Load the remote URL for development or the local html file for production.
if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
this.splashWindow?.loadURL(
`${process.env["ELECTRON_RENDERER_URL"]}#/splash`
`${process.env["ELECTRON_RENDERER_URL"]}/splash.html`
);
} else {
this.splashWindow?.loadFile(
path.join(__dirname, "../renderer/index.html"),
{
hash: "splash",
}
path.join(__dirname, "../renderer/splash.html")
);
}
}
public static createSplashScreen() {
this.splashWindow = new BrowserWindow({
width: 810,
height: 610,
minWidth: 810,
minHeight: 610,
titleBarStyle: "hidden",
...(process.platform === "linux" ? { icon } : {}),
transparent: true,
frame: false,
alwaysOnTop: true,
trafficLightPosition: { x: 16, y: 16 },
titleBarOverlay: {
symbolColor: "#DADBE1",
color: "#151515",
height: 34,
},
webPreferences: {
preload: path.join(__dirname, "../preload/index.mjs"),
sandbox: false,
},
width: 400,
height: 400,
frame: true,
alwaysOnTop: false,
});
this.loadSplashURL();
this.splashWindow.removeMenu();
}
public static createMainWindow() {