Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
testing manual update
Browse files Browse the repository at this point in the history
  • Loading branch information
horacioh committed Nov 13, 2023
1 parent df0b17e commit a4bdbdb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
39 changes: 23 additions & 16 deletions frontend/apps/desktop/src/auto-update.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import {IS_PROD_DESKTOP} from '@mintter/shared'
import {app, autoUpdater, ipcMain, ipcRenderer} from 'electron'
import {
MessageBoxOptions,
app,
autoUpdater,
dialog,
ipcMain,
ipcRenderer,
} from 'electron'
import log from 'electron-log/main'
import {ipcMainEvents} from './ipc-events'

Expand Down Expand Up @@ -88,21 +95,21 @@ function setup() {

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
log.debug('[MAIN][AUTO-UPDATE]: New version downloaded')
// const dialogOpts: MessageBoxOptions = {
// type: 'info',
// buttons: ['Restart', 'Later'],
// title: 'Application Update',
// message: process.platform == 'win32' ? releaseNotes : releaseName,
// detail:
// 'A new version has been downloaded. Restart the application to apply the updates.',
// }

// dialog.showMessageBox(dialogOpts).then((returnValue: any) => {
// log.debug('[MAIN][AUTO-UPDATE]: Quit and Install')
// if (returnValue.response === 0) autoUpdater.quitAndInstall()
// })

// ipcMain.emit(ipcMainEvents.UPDATE_DOWNLOADED)
const dialogOpts: MessageBoxOptions = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform == 'win32' ? releaseNotes : releaseName,
detail:
'A new version has been downloaded. Restart the application to apply the updates.',
}

dialog.showMessageBox(dialogOpts).then((returnValue: any) => {
log.debug('[MAIN][AUTO-UPDATE]: Quit and Install')
if (returnValue.response === 0) autoUpdater.quitAndInstall()
})

ipcMain.emit(ipcMainEvents.UPDATE_DOWNLOADED)
ipcRenderer.emit(ipcMainEvents.UPDATE_DOWNLOADED)
})

Expand Down
8 changes: 4 additions & 4 deletions frontend/apps/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
} from './app-api'
import {createAppMenu} from './app-menu'
import {initPaths} from './app-paths'
// import autoUpdate from './auto-update'
import {setupUpdates} from './update'
import autoUpdate from './auto-update'
// import {setupUpdates} from './update'
import {startMainDaemon} from './daemon'
import {saveCidAsFile} from './save-cid-as-file'

Expand Down Expand Up @@ -41,8 +41,8 @@ startMainDaemon()

Menu.setApplicationMenu(createAppMenu())

// autoUpdate()
setupUpdates()
autoUpdate()
// setupUpdates()

//Simple logging module Electron/Node.js/NW.js application. No dependencies. No complicated configuration.
log.initialize({
Expand Down
7 changes: 6 additions & 1 deletion frontend/packages/app/components/titlebar-windows-linux.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ export function SystemMenu() {
id: 'mintter',
title: 'Mintter',
children: [
{
id: 'updates',
title: 'Check for updates',
onSelect: () => triggerFocusedWindow('checkForUpdates'),
},
{
id: 'preferences',
title: 'Preferences...',
Expand Down Expand Up @@ -413,7 +418,7 @@ type SubMenuItemElement = {
id: string
title: string
onSelect: () => void
icon: ListItemProps['icon']
icon?: ListItemProps['icon']
accelerator?: string
disabled?: boolean
}
1 change: 1 addition & 0 deletions frontend/packages/app/utils/window-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type AppWindowSimpleEvent =
| 'forward'
| 'triggerPeerSync'
| 'openQuickSwitcher'
| 'checkForUpdates'

export type AppWindowEvent =
| AppWindowSimpleEvent
Expand Down

0 comments on commit a4bdbdb

Please sign in to comment.