Skip to content

Commit 70934cb

Browse files
committed
t
1 parent 3ad3b35 commit 70934cb

File tree

6 files changed

+7700
-173
lines changed

6 files changed

+7700
-173
lines changed

.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GH_TOKEN=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
2+
NPM_TOKEN=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

main.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
// Modules to control application life and create native browser window
22
require('update-electron-app')();
3-
const { app, BrowserWindow, globalShortcut, ipcMain} = require('electron');
3+
const { app, BrowserWindow, autoUpdater ,globalShortcut, ipcMain} = require('electron');
44
const path = require('path');
55
const ipc = ipcMain;
66

7+
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
8+
const dialogOpts = {
9+
type: 'info',
10+
buttons: ['Restart', 'Later'],
11+
title: 'Application Update',
12+
message: process.platform === 'win32' ? releaseNotes : releaseName,
13+
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
14+
}
15+
16+
dialog.showMessageBox(dialogOpts).then((returnValue) => {
17+
if (returnValue.response === 0) autoUpdater.quitAndInstall()
18+
})
19+
})
20+
21+
autoUpdater.on('error', message => {
22+
console.error('There was a problem updating the application')
23+
console.error(message)
24+
})
25+
726
// Keep a global reference of the window object, if you don't, the window will
827
// be closed automatically when the JavaScript object is garbage collected.
928
let mainWindow;
@@ -103,7 +122,9 @@ function createWindow() {
103122
// This method will be called when Electron has finished
104123
// initialization and is ready to create browser windows.
105124
// Some APIs can only be used after this event occurs.
106-
app.on('ready', createWindow);
125+
app.on('ready', createWindow, () => {
126+
autoUpdater.checkForUpdates();
127+
});
107128

108129
// Quit when all windows are closed.
109130
app.on('window-all-closed', function() {

0 commit comments

Comments
 (0)