pull/5370/head
bunsenstraat 1 year ago
parent bcae79ca72
commit 6b39a6ce2b
  1. 90
      apps/remix-ide/src/app/plugins/electron/appUpdaterPlugin.ts

@ -1,55 +1,55 @@
import { ElectronPlugin } from '@remixproject/engine-electron' import { ElectronPlugin } from '@remixproject/engine-electron'
const profile = { const profile = {
displayName: 'appUpdater', displayName: 'appUpdater',
name: 'appUpdater', name: 'appUpdater',
description: 'appUpdater', description: 'appUpdater',
} }
export class appUpdaterPlugin extends ElectronPlugin { export class appUpdaterPlugin extends ElectronPlugin {
constructor() { constructor() {
console.log('appUpdaterPlugin') console.log('appUpdaterPlugin')
super(profile) super(profile)
} }
onActivation(): void { onActivation(): void {
this.on('appUpdater', 'askForUpdate', () => { this.on('appUpdater', 'askForUpdate', () => {
console.log('askForUpdate') console.log('askForUpdate')
const upgradeModal = { const upgradeModal = {
id: 'confirmUpdate', id: 'confirmUpdate',
title: 'An update is available', title: 'An update is available',
message: `A new version of Remix Desktop is available. Do you want to update?`, message: `A new version of Remix Desktop is available. Do you want to update?`,
modalType: 'modal', modalType: 'modal',
okLabel: 'Yes', okLabel: 'Yes',
cancelLabel: 'No', cancelLabel: 'No',
okFn: () => { okFn: () => {
this.call('appUpdater', 'download') this.call('appUpdater', 'download')
}, },
cancelFn: () => { cancelFn: () => {
}, },
hideFn: () => null hideFn: () => null
} }
this.call('notification', 'modal', upgradeModal) this.call('notification', 'modal', upgradeModal)
}) })
this.on('appUpdater', 'downloadReady', () => { this.on('appUpdater', 'downloadReady', () => {
console.log('downloadReady') console.log('downloadReady')
const upgradeModal = { const upgradeModal = {
id: 'confirmInstall', id: 'confirmInstall',
title: 'An update is ready to install', title: 'An update is ready to install',
message: `A new version of Remix Desktop is ready to install. Do you want to install it now? This will close Remix Desktop.`, message: `A new version of Remix Desktop is ready to install. Do you want to install it now? This will close Remix Desktop.`,
modalType: 'modal', modalType: 'modal',
okLabel: 'Yes', okLabel: 'Yes',
cancelLabel: 'No', cancelLabel: 'No',
okFn: () => { okFn: () => {
this.call('appUpdater', 'install') this.call('appUpdater', 'install')
}, },
cancelFn: () => { cancelFn: () => {
}, },
hideFn: () => null hideFn: () => null
} }
this.call('notification', 'modal', upgradeModal) this.call('notification', 'modal', upgradeModal)
}) })
} }
} }
Loading…
Cancel
Save