From 863af354782cf4954120c26f2b2985fde9831e2a Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sat, 27 Jan 2024 09:02:13 +0100 Subject: [PATCH] add update plugin --- apps/remixdesktop/src/plugins/appUpdater.ts | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 apps/remixdesktop/src/plugins/appUpdater.ts diff --git a/apps/remixdesktop/src/plugins/appUpdater.ts b/apps/remixdesktop/src/plugins/appUpdater.ts new file mode 100644 index 0000000000..0143bbe8f5 --- /dev/null +++ b/apps/remixdesktop/src/plugins/appUpdater.ts @@ -0,0 +1,39 @@ +import { ElectronBasePlugin, ElectronBasePluginClient } from "@remixproject/plugin-electron" +import { Profile } from "@remixproject/plugin-utils" +import { autoUpdater } from "electron" +import { profile } from "node:console" + +export class appUpdaterPlugin extends ElectronBasePlugin { + constructor() { + super(profile, clientProfile, appUpdaterPluginClient) + this.methods = [...super.methods] + } +} + +const clientProfile: Profile = { + name: 'appUpdater', + displayName: 'appUpdater', + description: 'appUpdater', + methods: ['checkForUpdates'], +} + +class appUpdaterPluginClient extends ElectronBasePluginClient { + constructor(webContentsId: number, profile: Profile) { + super(webContentsId, profile) + } + + async onActivation(): Promise { + console.log('onActivation', 'appUpdaterPluginClient') + this.onload(() => { + console.log('onload', 'appUpdaterPluginClient') + this.emit('loaded') + }) + } + + async checkForUpdates(): Promise { + console.log('checkForUpdates') + autoUpdater.checkForUpdates() + } +} + +export default appUpdaterPlugin