11var app = require ( 'app' ) ;
22var path = require ( 'path' ) ;
33var ipc = require ( 'ipc' ) ;
4-
5- var ghReleases = require ( 'electron-gh-releases' ) ;
4+ var autoUpdater = require ( 'auto-updater' ) ;
65
76require ( 'crash-reporter' ) . start ( ) ;
87
@@ -14,47 +13,29 @@ var AutoLaunch = require('auto-launch');
1413var iconIdle = path . join ( __dirname , 'images' , 'tray-idleTemplate.png' ) ;
1514var 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
5940var autoStart = new AutoLaunch ( {
6041 name : 'Gitify' ,
0 commit comments