Remove hacky splash window with a background color
...hacky because it was using a timer instead of the "ready-to-show" event (which wasn't getting fired for some reason). It is recommended that we set a background color anyway.
This commit is contained in:
parent
ac97d65c12
commit
88e8e1a18d
2 changed files with 10 additions and 105 deletions
|
@ -1,50 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ente Photos</title>
|
||||
</head>
|
||||
|
||||
<body style="background-color: black">
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 90vh;
|
||||
"
|
||||
>
|
||||
<div style="width: 64px">
|
||||
<svg
|
||||
version="1.1"
|
||||
id="L9"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 100 100"
|
||||
enable-background="new 0 0 0 0"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<path
|
||||
fill="#2dc262"
|
||||
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
||||
>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
attributeType="XML"
|
||||
type="rotate"
|
||||
dur="1s"
|
||||
from="0 50 50"
|
||||
to="360 50 50"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -31,34 +31,21 @@ export const createWindow = async () => {
|
|||
preload: path.join(app.getAppPath(), "preload.js"),
|
||||
},
|
||||
icon: appIcon,
|
||||
// Don't show the main window on load, we'll show the `splashWindow`
|
||||
// instead until it gets ready-to-show.
|
||||
// The color to show in the window until the web content gets loaded.
|
||||
// See: https://www.electronjs.org/docs/latest/api/browser-window#setting-the-backgroundcolor-property
|
||||
backgroundColor: "black",
|
||||
// We'll show conditionally depending on `wasAutoLaunched` later
|
||||
show: false,
|
||||
});
|
||||
|
||||
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
|
||||
ElectronLog.log("wasAutoLaunched", wasAutoLaunched);
|
||||
|
||||
// Create a splash window to show until the web content loads.
|
||||
const splashWindow = new BrowserWindow({
|
||||
transparent: true,
|
||||
show: false,
|
||||
});
|
||||
|
||||
if (process.platform == "darwin" && wasAutoLaunched) {
|
||||
app.dock.hide();
|
||||
}
|
||||
|
||||
if (!wasAutoLaunched) {
|
||||
splashWindow.maximize();
|
||||
splashWindow.show();
|
||||
}
|
||||
|
||||
if (isDev) {
|
||||
splashWindow.loadFile("../build/splash.html");
|
||||
if (wasAutoLaunched) {
|
||||
// Keep the macOS dock icon hidden if we were auto launched.
|
||||
if (process.platform == "darwin") app.dock.hide();
|
||||
} else {
|
||||
const splashHTMLPath = path.join(process.resourcesPath, "splash.html");
|
||||
splashWindow.loadURL(`file://${splashHTMLPath}`);
|
||||
// Show our window (maximizing it) if this is not an auto-launch on
|
||||
// login.
|
||||
mainWindow.maximize();
|
||||
}
|
||||
|
||||
mainWindow.loadURL(rendererURL);
|
||||
|
@ -66,14 +53,6 @@ export const createWindow = async () => {
|
|||
// Open the DevTools automatically when running in dev mode
|
||||
if (isDev) mainWindow.webContents.openDevTools();
|
||||
|
||||
mainWindow.once("ready-to-show", async () => {
|
||||
splashWindow.destroy();
|
||||
if (!wasAutoLaunched) {
|
||||
mainWindow.maximize();
|
||||
mainWindow.show();
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.webContents.on("render-process-gone", (event, details) => {
|
||||
mainWindow.webContents.reload();
|
||||
logErrorSentry(
|
||||
|
@ -89,18 +68,6 @@ export const createWindow = async () => {
|
|||
ElectronLog.log("webContents event unresponsive");
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
try {
|
||||
splashWindow.destroy();
|
||||
if (!wasAutoLaunched) {
|
||||
mainWindow.maximize();
|
||||
mainWindow.show();
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
mainWindow.on("close", function (event) {
|
||||
if (!isAppQuitting()) {
|
||||
event.preventDefault();
|
||||
|
@ -125,18 +92,6 @@ export const createWindow = async () => {
|
|||
return mainWindow;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the source root for the desktop code, i.e. the "desktop" directory in
|
||||
* our repository which contains the package.json.
|
||||
*
|
||||
* This is useful to
|
||||
*/
|
||||
const srcRoot = () => {
|
||||
// __dirname will be the directory which contains this file. However, this
|
||||
// file is not the one which is running - it'll get transpiled into JS, so
|
||||
// the actual running file will be `app/main/init.js`. To get to the source
|
||||
// root (the "desktop" folder), we need to go up two levels.
|
||||
};
|
||||
export async function handleUpdates(mainWindow: BrowserWindow) {
|
||||
const isInstalledViaBrew = await checkIfInstalledViaBrew();
|
||||
if (!isDev && !isInstalledViaBrew) {
|
||||
|
|
Loading…
Add table
Reference in a new issue