Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor committed Jun 16, 2022
1 parent b58cd53 commit 6b66dd1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amethyst",
"author": "amethyst <geoxor123@outlook.com>",
"productName": "Amethyst",
"version": "1.3.7",
"version": "1.3.8",
"main": "./release/dist/main/main.js",
"licenses": [
{
Expand Down
14 changes: 2 additions & 12 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import path from "path";
import { app } from "electron";

import { MainWindow } from "./mainWindow";
import { checkForUpdatesAndInstall, MainWindow } from "./mainWindow";

export const IS_DEV = process.env.NODE_ENV === "development" || process.env.DEBUG_PROD === "true";
export const RESOURCES_PATH = path.join(__dirname, "../".repeat(+app.isPackaged * 2 + 2), "assets");
Expand Down Expand Up @@ -67,17 +67,7 @@ else {
}).catch(console.error);
}

async function checkForUpdatesAndInstall() {
return import("electron-updater")
.then(({ autoUpdater }) => {
autoUpdater.checkForUpdatesAndNotify({
title: "Update Installing",
body: "The application will restart once the update is complete.",
});
autoUpdater.on("update-downloaded", () => autoUpdater.quitAndInstall(true, true));
})
.catch(e => console.error("Failed check updates:", e));
}


if (!IS_DEV) {
app
Expand Down
20 changes: 19 additions & 1 deletion src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ export class MainWindow {
child.once('ready-to-show', () => {
child.show()
})
}
},
"check-for-updates": () => {
if (IS_DEV)
return;

checkForUpdatesAndInstall();
}
}).forEach(([channel, handler]) => ipcMain.handle(channel, handler));
}

Expand All @@ -164,3 +170,15 @@ export class MainWindow {
).toString("base64");
}
}

export async function checkForUpdatesAndInstall() {
return import("electron-updater")
.then(({ autoUpdater }) => {
autoUpdater.checkForUpdatesAndNotify({
title: "Update Installing",
body: "The application will restart once the update is complete.",
});
autoUpdater.on("update-downloaded", () => autoUpdater.quitAndInstall(true, true));
})
.catch(e => console.error("Failed check updates:", e));
}
3 changes: 2 additions & 1 deletion src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type Channels =
"update-rich-presence" |
"sync-window-state" |
"drop-file" |
"open-preferences";
"open-preferences" |
"check-for-updates";

contextBridge.exposeInMainWorld("electron", {
ipcRenderer: {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const openPreferences = () => {
:title="`Clear BPM cache (${bytesToHuman(state.bpmCacheSize.value)})`"
@click="state.state.bpmCache = {}"
/>
<menu-option
:title="`Check for updates`"
@click="electron.invoke('check-for-updates')"
/>
</Menu>

<Menu title="Help">
Expand Down

0 comments on commit 6b66dd1

Please sign in to comment.