Skip to content

Commit

Permalink
fix auto update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Sep 18, 2017
1 parent 737dc6c commit b853540
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ autoUpdater.on('update-not-available', e => {
console.log('Update not available.');
});

autoUpdater.on('update-available', e => {
downloading = true;
checkForUpdates();
});

autoUpdater.on('error', err => {
dialog.showMessageBox({
type: 'error',
Expand All @@ -670,6 +675,24 @@ autoUpdater.on('error', err => {
console.error(err);
});

autoUpdater.on('update-downloaded', e => {
autoUpdater.on('update-downloaded', info => {
var { releaseNotes, releaseName } = info;
var index = dialog.showMessageBox({
type: 'info',
buttons: ['Restart', 'Later'],
title: pkg.name,
message: `The new version has been downloaded. Please restart the application to apply the updates.`,
detail: `${releaseName}\n\n${releaseNotes}`
});
downloading = false;

if (index === 1) {
return;
}

autoUpdater.quitAndInstall();
setTimeout(() => {
mainWindow = null;
app.quit();
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wewechat",
"version": "1.1.3",
"version": "1.1.2",
"description": "Unofficial WeChat client built with React, MobX and Electron.",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit b853540

Please sign in to comment.