@@ -7,9 +7,9 @@ const appMenuTemplate = require('./electron/app-menu-template');
77const iconIdle = path . join ( __dirname , 'images' , 'tray-idleTemplate.png' ) ;
88const iconActive = path . join ( __dirname , 'images' , 'tray-active.png' ) ;
99
10- const isDarwin = ( process . platform === 'darwin' ) ;
11- const isLinux = ( process . platform === 'linux' ) ;
12- const isWindows = ( process . platform === 'win32' ) ;
10+ const isDarwin = process . platform === 'darwin' ;
11+ const isLinux = process . platform === 'linux' ;
12+ const isWindows = process . platform === 'win32' ;
1313
1414let appWindow ;
1515let appIcon = null ;
@@ -18,7 +18,7 @@ let isQuitting = false;
1818const autoStart = new AutoLaunch ( {
1919 name : 'Gitify' ,
2020 path : process . execPath . match ( / .* ?\. a p p / ) [ 0 ] ,
21- isHidden : true
21+ isHidden : true ,
2222} ) ;
2323
2424app . on ( 'ready' , function ( ) {
@@ -28,16 +28,18 @@ app.on('ready', function() {
2828 const trayMenu = Menu . buildFromTemplate ( [
2929 {
3030 label : 'Show Gitify' ,
31- click ( ) { appWindow . show ( ) ; }
31+ click ( ) {
32+ appWindow . show ( ) ;
33+ } ,
3234 } ,
3335 {
34- type : 'separator'
36+ type : 'separator' ,
3537 } ,
3638 {
3739 label : 'Quit' ,
3840 accelerator : isDarwin ? 'Command+Q' : 'Alt+F4' ,
39- role : 'quit'
40- }
41+ role : 'quit' ,
42+ } ,
4143 ] ) ;
4244
4345 trayIcon . setToolTip ( 'GitHub Notifications on your menu bar.' ) ;
@@ -46,28 +48,33 @@ app.on('ready', function() {
4648 }
4749
4850 function confirmAutoUpdate ( updater ) {
49- dialog . showMessageBox ( {
50- type : 'question' ,
51- buttons : [ 'Update & Restart' , 'Cancel' ] ,
52- title : 'Update Available' ,
53- cancelId : 99 ,
54- message : 'There is an update available. Would you like to update Gitify now?'
55- } , ( response ) => {
56- console . log ( 'Exit: ' + response ) ; // eslint-disable-line no-console
57-
58- if ( response === 0 ) {
59- updater . install ( ) ;
51+ dialog . showMessageBox (
52+ {
53+ type : 'question' ,
54+ buttons : [ 'Update & Restart' , 'Cancel' ] ,
55+ title : 'Update Available' ,
56+ cancelId : 99 ,
57+ message :
58+ 'There is an update available. Would you like to update Gitify now?' ,
59+ } ,
60+ response => {
61+ console . log ( 'Exit: ' + response ) ; // eslint-disable-line no-console
62+
63+ if ( response === 0 ) {
64+ updater . install ( ) ;
65+ }
6066 }
61- } ) ;
67+ ) ;
6268 }
6369
6470 function checkAutoUpdate ( showAlert ) {
65-
66- if ( isWindows || isLinux ) { return ; }
71+ if ( isWindows || isLinux ) {
72+ return ;
73+ }
6774
6875 let autoUpdateOptions = {
6976 repo : 'manosim/gitify' ,
70- currentVersion : app . getVersion ( )
77+ currentVersion : app . getVersion ( ) ,
7178 } ;
7279
7380 const updater = new GhReleases ( autoUpdateOptions ) ;
@@ -92,7 +99,7 @@ app.on('ready', function() {
9299 type : 'info' ,
93100 buttons : [ 'Close' ] ,
94101 title : 'No update available' ,
95- message : 'You are currently running the latest version of Gitify.'
102+ message : 'You are currently running the latest version of Gitify.' ,
96103 } ) ;
97104 }
98105 }
@@ -103,7 +110,7 @@ app.on('ready', function() {
103110 } ) ;
104111 }
105112
106- function initWindow ( ) {
113+ function initWindow ( ) {
107114 let defaults = {
108115 width : 500 ,
109116 height : 600 ,
@@ -114,15 +121,15 @@ app.on('ready', function() {
114121 fullscreenable : false ,
115122 titleBarStyle : 'hidden-inset' ,
116123 webPreferences : {
117- overlayScrollbars : true
118- }
124+ overlayScrollbars : true ,
125+ } ,
119126 } ;
120127
121128 appWindow = new BrowserWindow ( defaults ) ;
122129 appWindow . loadURL ( 'file://' + __dirname + '/index.html' ) ;
123130 appWindow . show ( ) ;
124131
125- appWindow . on ( 'close' , function ( event ) {
132+ appWindow . on ( 'close' , function ( event ) {
126133 if ( ! isQuitting ) {
127134 event . preventDefault ( ) ;
128135 appWindow . hide ( ) ;
@@ -137,12 +144,12 @@ app.on('ready', function() {
137144 appIcon = createAppIcon ( ) ;
138145 initWindow ( ) ;
139146
140- ipcMain . on ( 'reopen-window' , ( ) => appWindow . show ( ) ) ;
141- ipcMain . on ( 'startup-enable' , ( ) => autoStart . enable ( ) ) ;
142- ipcMain . on ( 'startup-disable' , ( ) => autoStart . disable ( ) ) ;
143- ipcMain . on ( 'check-update' , ( ) => checkAutoUpdate ( true ) ) ;
147+ ipcMain . on ( 'reopen-window' , ( ) => appWindow . show ( ) ) ;
148+ ipcMain . on ( 'startup-enable' , ( ) => autoStart . enable ( ) ) ;
149+ ipcMain . on ( 'startup-disable' , ( ) => autoStart . disable ( ) ) ;
150+ ipcMain . on ( 'check-update' , ( ) => checkAutoUpdate ( true ) ) ;
144151 ipcMain . on ( 'set-badge' , ( event , count ) => app . setBadgeCount ( count ) ) ;
145- ipcMain . on ( 'app-quit' , ( ) => app . quit ( ) ) ;
152+ ipcMain . on ( 'app-quit' , ( ) => app . quit ( ) ) ;
146153
147154 ipcMain . on ( 'update-icon' , ( event , arg ) => {
148155 if ( ! appIcon . isDestroyed ( ) ) {
@@ -180,7 +187,7 @@ app.on('ready', function() {
180187 } ) ;
181188} ) ;
182189
183- app . on ( 'activate' , ( ) => appWindow . show ( ) ) ;
190+ app . on ( 'activate' , ( ) => appWindow . show ( ) ) ;
184191
185192app . on ( 'window-all-closed' , ( ) => {
186193 if ( ! isDarwin ) {
0 commit comments