Skip to content

Commit 468f249

Browse files
author
Emmanouil Konstantinidis
committed
Auto Update ✨
1 parent 9bcd043 commit 468f249

File tree

2 files changed

+23
-41
lines changed

2 files changed

+23
-41
lines changed

main.js

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

76
require('crash-reporter').start();
87

@@ -14,47 +13,29 @@ var AutoLaunch = require('auto-launch');
1413
var iconIdle = path.join(__dirname, 'images', 'tray-idleTemplate.png');
1514
var iconActive = path.join(__dirname, 'images', 'tray-active.png');
1615

17-
var ghReleasesOptions = {
18-
repo: 'ekonstantinidis/gitify',
19-
currentVersion: app.getVersion()
20-
};
21-
22-
var update = new ghReleases(ghReleasesOptions, function (autoUpdater) {
23-
autoUpdater
24-
.on('checking-for-update', function() {
25-
console.log('Checking for update');
26-
})
27-
.on('update-downloaded', function (e, rNotes, rName, rDate, uUrl, quitAndUpdate) {
28-
// Install the update
29-
console.log('Update Downloaded...');
30-
quitAndUpdate();
31-
});
32-
});
33-
34-
// Check for updates
35-
update.check(function (err, status) {
36-
if (err) {
16+
autoUpdater
17+
.on('error', function(event, message) {
3718
console.log('ERRORED.');
38-
console.log('ERR: ' + err + '. STATUS: ' + status);
39-
}
40-
41-
if (!err && status) {
42-
console.log('There is an update!');
43-
update.download();
44-
}
45-
});
19+
console.log('Event: ' + JSON.stringify(event) + '. MESSAGE: ' + message);
20+
})
21+
.on('checking-for-update', function () {
22+
console.log('Checking for update');
23+
})
24+
.on('update-available', function () {
25+
console.log('Update available');
26+
})
27+
.on('update-not-available', function () {
28+
console.log('Update not available');
29+
})
30+
.on('update-downloaded', function (event, releaseNotes, releaseName,
31+
releaseDate, updateUrl, quitAndUpdate) {
32+
console.log('Update downloaded');
33+
quitAndUpdate();
34+
});
4635

47-
// autoUpdater
48-
//
49-
// .on('update-available', function() {
50-
// console.log('Update available');
51-
// })
52-
// .on('update-not-available', function() {
53-
// console.log('Update not available');
54-
// })
55-
// .on('update-downloaded', function() {
56-
// console.log('Update downloaded');
57-
// });
36+
autoUpdater.setFeedUrl('https://raw.githubusercontent.com/' +
37+
'ekonstantinidis/gitify/master/auto_updater.json');
38+
autoUpdater.checkForUpdates();
5839

5940
var autoStart = new AutoLaunch({
6041
name: 'Gitify',

scripts/codesign.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
codesign --verbose --deep --force --sign "Developer ID Application: Emmanouil KONSTANTINIDIS" Gitify-darwin-x64/Gitify.app

0 commit comments

Comments
 (0)