Skip to content

Commit

Permalink
added gh-release-autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
hanayik committed Feb 27, 2017
1 parent a002027 commit d93e5ea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
26 changes: 25 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,30 @@ const ffmpeg = appRootDir+'/ffmpeg/ffmpeg'
const exec = require( 'child_process' ).exec
const system = require('system-control')();
const notifier = require('electron-notifications')
const GhReleases = require('electron-gh-releases')
app.setName("PNT")
let options = {
repo: 'hanayik/Philadelphia-Naming-Test',
currentVersion: app.getVersion()
}
const updater = new GhReleases(options)
// Check for updates
// `status` returns true if there is a new update available
updater.check((err, status) => {
if (!err && status) {
// Download the update
updater.download()
}
})

// When an update has been downloaded
updater.on('update-downloaded', (info) => {
// Restart the app and install the update
updater.install()
})

// Access electrons autoUpdater
updater.autoUpdater
//icon credit: http://www.flaticon.com/authors/madebyoliver

// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -57,7 +80,8 @@ function createWindow () {
const notification = notifier.notify(app.getName(), {
message: "Your screen is dim.",
buttons: ['Illuminate', 'Cancel'],
duration: 20000
duration: 20000,
icon: path.join(__dirname, 'icon.png')
})
notification.on('buttonClicked', (text) => {
console.log(text)
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"dependencies": {
"app-root-dir": "^1.0.2",
"csvsync": "^1.0.1",
"electron-gh-releases": "^2.0.4",
"electron-notifications": "^0.1.6",
"jQuery": "^1.7.4",
"moment": "^2.17.1",
Expand Down

0 comments on commit d93e5ea

Please sign in to comment.