-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from rishiqing/beta
beta
- Loading branch information
Showing
5 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const Notification = require('electron').Notification; | ||
const autoUpdater = require('electron-updater').autoUpdater; | ||
const pkg = require('../package.json'); | ||
const Sentry = require('./sentry'); | ||
|
||
class Update { | ||
constructor (mainWindow) { | ||
this.mainWindow = mainWindow; | ||
this.webContents = mainWindow.webContents; | ||
this.setAutoUpdate(); | ||
} | ||
setAutoUpdate () { | ||
autoUpdater.on('update-downloaded', function (info) { | ||
const notify = new Notification({ | ||
title: `日事清V${info.version} 已准备就绪!`, | ||
body: `请退出当前应用,以便完成更新!` | ||
}); | ||
notify.show(); | ||
}); | ||
autoUpdater.on('error', function (error) { | ||
const notify = new Notification({ | ||
title: '日事清PC端自动更新出错了!!!', | ||
body: error.message | ||
}); | ||
Sentry.captureException(new Error(error)); | ||
notify.show(); | ||
}); | ||
if (pkg.env !== 'dev' && pkg.env !== 'debug') { | ||
autoUpdater.checkForUpdates(); | ||
} | ||
} | ||
} | ||
module.exports = Update; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters