messing around and testing

This commit is contained in:
Zamitto 2024-05-18 00:13:43 -03:00
parent cdad2f5554
commit 10943408e9
3 changed files with 55 additions and 3 deletions

View file

@ -63,11 +63,18 @@ app.whenReady().then(() => {
where: { id: 1 },
});
WindowManager.createMainWindow();
WindowManager.createSplashScreen();
WindowManager.createSystemTray(userPreferences?.language || "en");
WindowManager.mainWindow?.on("ready-to-show", () => {
autoUpdater.checkForUpdatesAndNotify();
WindowManager.splashWindow?.on("ready-to-show", () => {
console.log("ready to show");
autoUpdater.checkForUpdates().then((r) => {
console.log(r);
WindowManager.splashWindow?.close();
WindowManager.createMainWindow();
});
});
});
});

View file

@ -17,6 +17,7 @@ import { IsNull, Not } from "typeorm";
export class WindowManager {
public static mainWindow: Electron.BrowserWindow | null = null;
public static splashWindow: Electron.BrowserWindow | null = null;
private static loadURL(hash = "") {
// HMR for renderer base on electron-vite cli.
@ -35,6 +36,49 @@ 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() {
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,
},
});
this.loadSplashURL();
}
public static createMainWindow() {
// Create the browser window.
this.mainWindow = new BrowserWindow({

View file

@ -54,6 +54,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<Route path="/game/:shop/:objectID" Component={GameDetails} />
<Route path="/search" Component={SearchResults} />
<Route path="/settings" Component={Settings} />
<Route path="/splash" Component={Settings} />
</Routes>
</App>
</HashRouter>