fix update dialog
This commit is contained in:
parent
a72ae1df5f
commit
db03ed552f
23
main.js
23
main.js
|
@ -430,6 +430,12 @@ function registerIPCPipes() {
|
||||||
return config.all();
|
return config.all();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:checkUpdate", async (e) => {
|
||||||
|
const updateInfo = await updateAvailable();
|
||||||
|
if (updateInfo.update)
|
||||||
|
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:exitAndUpdate", async (e) => {
|
ipcMain.handle("ezpplauncher:exitAndUpdate", async (e) => {
|
||||||
await shell.openExternal(releasesUrl);
|
await shell.openExternal(releasesUrl);
|
||||||
app.exit();
|
app.exit();
|
||||||
|
@ -523,9 +529,8 @@ function registerIPCPipes() {
|
||||||
progress: Math.ceil(data.progress),
|
progress: Math.ceil(data.progress),
|
||||||
});
|
});
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total)
|
||||||
formatBytes(data.total)
|
})...`,
|
||||||
})...`,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await updateDownloader.startDownload();
|
await updateDownloader.startDownload();
|
||||||
|
@ -578,9 +583,8 @@ function registerIPCPipes() {
|
||||||
progress: Math.ceil(data.progress),
|
progress: Math.ceil(data.progress),
|
||||||
});
|
});
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: `Downloading ${data.fileName}(${
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)
|
||||||
formatBytes(data.loaded)
|
}/${formatBytes(data.total)})...`,
|
||||||
}/${formatBytes(data.total)})...`,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await patcherDownloader.startDownload();
|
await patcherDownloader.startDownload();
|
||||||
|
@ -714,8 +718,7 @@ function registerIPCPipes() {
|
||||||
const osuGameplayFile = path.join(osuPath, "osu!gameplay.dll");
|
const osuGameplayFile = path.join(osuPath, "osu!gameplay.dll");
|
||||||
if (isWritable(osuUIFile) && isWritable(osuGameplayFile)) {
|
if (isWritable(osuUIFile) && isWritable(osuGameplayFile)) {
|
||||||
logger.log(
|
logger.log(
|
||||||
`Cleanup complete, took ${
|
`Cleanup complete, took ${((performance.now() - timeStart) / 1000).toFixed(3)
|
||||||
((performance.now() - timeStart) / 1000).toFixed(3)
|
|
||||||
} seconds.`,
|
} seconds.`,
|
||||||
);
|
);
|
||||||
clearInterval(cleanup);
|
clearInterval(cleanup);
|
||||||
|
@ -819,10 +822,6 @@ function createWindow() {
|
||||||
// Emitted when the window is ready to be shown
|
// Emitted when the window is ready to be shown
|
||||||
// This helps in showing the window gracefully.
|
// This helps in showing the window gracefully.
|
||||||
mainWindow.once("ready-to-show", async () => {
|
mainWindow.once("ready-to-show", async () => {
|
||||||
const updateInfo = await updateAvailable();
|
|
||||||
if (updateInfo.update) {
|
|
||||||
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
|
||||||
}
|
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,6 +82,10 @@ window.addEventListener("settings-set", async (e) => {
|
||||||
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("updateCheck", async () => {
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:checkUpdate");
|
||||||
|
})
|
||||||
|
|
||||||
window.addEventListener("updateExit", async () => {
|
window.addEventListener("updateExit", async () => {
|
||||||
await ipcRenderer.invoke("ezpplauncher:exitAndUpdate");
|
await ipcRenderer.invoke("ezpplauncher:exitAndUpdate");
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,6 +66,8 @@
|
||||||
window.dispatchEvent(new CustomEvent("updateExit"));
|
window.dispatchEvent(new CustomEvent("updateExit"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.dispatchEvent(new CustomEvent("updateCheck"));
|
||||||
|
|
||||||
window.addEventListener("open-settings", (e) => {
|
window.addEventListener("open-settings", (e) => {
|
||||||
currentPage.set(Page.Settings);
|
currentPage.set(Page.Settings);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user