Skip to content

Commit

Permalink
Merge pull request #50 from wakatime/bugfix/auto-updater
Browse files Browse the repository at this point in the history
Use electron-updater instead of update-electron-app
  • Loading branch information
alanhamlett authored Oct 17, 2024
2 parents cbb66f4 + 1a59456 commit e65e3c9
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 43 deletions.
23 changes: 14 additions & 9 deletions electron/watchers/wakatime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MonitoringManager } from "../helpers/monitoring-manager";
import { PropertiesManager } from "../helpers/properties-manager";
import { SettingsManager } from "../helpers/settings-manager";
import { WindowInfo } from "@miniben90/x-win";
import { updateElectronApp } from "update-electron-app";
import { autoUpdater } from "electron-updater";

export class Wakatime {
private lastEntitiy = "";
Expand All @@ -36,15 +36,20 @@ export class Wakatime {
this.tray = tray;

if (PropertiesManager.autoUpdateEnabled) {
updateElectronApp({
logger: {
log: (message) => Logging.instance().log(message, LogLevel.DEBUG),
error: (message) => Logging.instance().log(message, LogLevel.ERROR),
info: (message) => Logging.instance().log(message, LogLevel.INFO),
warn: (message) => Logging.instance().log(message, LogLevel.WARN),
},
updateInterval: "10 minutes",
autoUpdater.checkForUpdatesAndNotify();
/*
autoUpdater.on("update-available", () => {
console.log("Update available");
});
autoUpdater.on("update-downloaded", () => {
autoUpdater.quitAndInstall();
});
app.on("ready", () => {
autoUpdater.checkForUpdatesAndNotify();
});
*/
}

if (PropertiesManager.shouldLogToFile) {
Expand Down
118 changes: 86 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"electron-store": "^10.0.0",
"electron-updater": "^6.3.9",
"globals": "^15.9.0",
"icon-promise": "^1.1.1",
"iconutil": "^1.0.2",
Expand All @@ -43,7 +44,6 @@
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"unzipper": "^0.12.3",
"update-electron-app": "^3.0.0",
"usehooks-ts": "^3.1.0",
"winreg": "^1.2.5",
"zod": "^3.23.8"
Expand Down Expand Up @@ -79,4 +79,4 @@
"vite-plugin-native": "^2.2.1"
},
"main": "dist-electron/main.js"
}
}

0 comments on commit e65e3c9

Please sign in to comment.