Skip to content

Commit 40397d3

Browse files
author
Emmanouil Konstantinidis
committed
Use ''electron-gh-releases'
1 parent c3702ee commit 40397d3

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

main.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var app = require('app');
22
var path = require('path');
33
var ipc = require('ipc');
4-
var autoUpdater = require('auto-updater');
4+
var ghReleases = require('electron-gh-releases');
55

66
require('crash-reporter').start();
77

@@ -94,32 +94,34 @@ app.on('ready', function(){
9494

9595
function checkAutoUpdate() {
9696

97-
autoUpdater
98-
.on('error', function(event, message) {
99-
console.log('ERRORED.');
100-
console.log('Event: ' + JSON.stringify(event) + '. MESSAGE: ' + message);
101-
app.dock.hide();
102-
})
103-
.on('checking-for-update', function () {
104-
console.log('Checking for update');
105-
})
106-
.on('update-available', function () {
107-
console.log('Update available');
108-
// AutoUpdater Downloads the update automatically
109-
})
110-
.on('update-not-available', function () {
111-
console.log('Update not available');
97+
var autoUpdateOptions = {
98+
repo: 'ekonstantinidis/gitify',
99+
currentVersion: app.getVersion()
100+
};
101+
102+
var update = new ghReleases(autoUpdateOptions, function (autoUpdater) {
103+
autoUpdater
104+
.on('error', function(event, message) {
105+
console.log('ERRORED.');
106+
console.log('Event: ' + JSON.stringify(event) + '. MESSAGE: ' + message);
107+
})
108+
.on('update-downloaded', function (event, releaseNotes, releaseName,
109+
releaseDate, updateUrl, quitAndUpdate) {
110+
console.log('Update downloaded');
111+
confirmAutoUpdate(quitAndUpdate);
112+
});
113+
});
114+
115+
// Check for updates
116+
update.check(function (err, status) {
117+
if (err || !status) {
112118
app.dock.hide();
113-
})
114-
.on('update-downloaded', function (event, releaseNotes, releaseName,
115-
releaseDate, updateUrl, quitAndUpdate) {
116-
console.log('Update downloaded');
117-
confirmAutoUpdate(quitAndUpdate);
118-
});
119-
120-
autoUpdater.setFeedUrl('https://raw.githubusercontent.com/' +
121-
'ekonstantinidis/gitify/master/auto-update.json');
122-
autoUpdater.checkForUpdates();
119+
}
120+
121+
if (!err && status) {
122+
update.download();
123+
}
124+
});
123125
}
124126

125127
function confirmAutoUpdate(quitAndUpdate) {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitify",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"description": "GitHub Notifications on your menu bar.",
55
"main": "main.js",
66
"scripts": {
@@ -78,6 +78,7 @@
7878
"babelify": "=6.1.3",
7979
"bootstrap": "=3.3.5",
8080
"browserify": "=11.0.1",
81+
"electron-gh-releases": "=1.0.1",
8182
"font-awesome": "=4.4.0",
8283
"octicons": "=2.4.1",
8384
"react": "=0.13.3",

0 commit comments

Comments
 (0)