mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: remove splash and add new subheader to request user to restart and install update
This commit is contained in:
parent
21305d3e39
commit
cdd18a8ce2
14 changed files with 131 additions and 280 deletions
|
@ -17,9 +17,6 @@ import { IsNull, Not } from "typeorm";
|
|||
|
||||
export class WindowManager {
|
||||
public static mainWindow: Electron.BrowserWindow | null = null;
|
||||
public static splashWindow: Electron.BrowserWindow | null = null;
|
||||
public static isReadyToShowMainWindow = false;
|
||||
private static isMainMaximized = false;
|
||||
|
||||
private static loadURL(hash = "") {
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
|
@ -38,48 +35,8 @@ export class WindowManager {
|
|||
}
|
||||
}
|
||||
|
||||
private static loadSplashURL() {
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// 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`
|
||||
);
|
||||
} else {
|
||||
this.splashWindow?.loadFile(
|
||||
path.join(__dirname, "../renderer/index.html"),
|
||||
{
|
||||
hash: "splash",
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static createSplashScreen() {
|
||||
if (this.splashWindow) return;
|
||||
|
||||
this.splashWindow = new BrowserWindow({
|
||||
width: 380,
|
||||
height: 380,
|
||||
frame: false,
|
||||
resizable: false,
|
||||
backgroundColor: "#1c1c1c",
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "../preload/index.mjs"),
|
||||
sandbox: false,
|
||||
},
|
||||
});
|
||||
|
||||
this.loadSplashURL();
|
||||
this.splashWindow.removeMenu();
|
||||
if (this.splashWindow?.isMaximized()) {
|
||||
this.splashWindow?.unmaximize();
|
||||
this.isMainMaximized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static createMainWindow() {
|
||||
if (this.mainWindow || !this.isReadyToShowMainWindow) return;
|
||||
if (this.mainWindow) return;
|
||||
|
||||
this.mainWindow = new BrowserWindow({
|
||||
width: 1200,
|
||||
|
@ -104,7 +61,6 @@ export class WindowManager {
|
|||
|
||||
this.loadURL();
|
||||
this.mainWindow.removeMenu();
|
||||
if (this.isMainMaximized) this.mainWindow?.maximize();
|
||||
|
||||
this.mainWindow.on("ready-to-show", () => {
|
||||
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
||||
|
@ -123,12 +79,6 @@ export class WindowManager {
|
|||
});
|
||||
}
|
||||
|
||||
public static prepareMainWindowAndCloseSplash() {
|
||||
this.isReadyToShowMainWindow = true;
|
||||
this.splashWindow?.close();
|
||||
this.createMainWindow();
|
||||
}
|
||||
|
||||
public static redirect(hash: string) {
|
||||
if (!this.mainWindow) this.createMainWindow();
|
||||
this.loadURL(hash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue