@@ -7,9 +7,9 @@ const appMenuTemplate = require('./electron/app-menu-template');
7
7
const iconIdle = path . join ( __dirname , 'images' , 'tray-idleTemplate.png' ) ;
8
8
const iconActive = path . join ( __dirname , 'images' , 'tray-active.png' ) ;
9
9
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' ;
13
13
14
14
let appWindow ;
15
15
let appIcon = null ;
@@ -18,7 +18,7 @@ let isQuitting = false;
18
18
const autoStart = new AutoLaunch ( {
19
19
name : 'Gitify' ,
20
20
path : process . execPath . match ( / .* ?\. a p p / ) [ 0 ] ,
21
- isHidden : true
21
+ isHidden : true ,
22
22
} ) ;
23
23
24
24
app . on ( 'ready' , function ( ) {
@@ -28,16 +28,18 @@ app.on('ready', function() {
28
28
const trayMenu = Menu . buildFromTemplate ( [
29
29
{
30
30
label : 'Show Gitify' ,
31
- click ( ) { appWindow . show ( ) ; }
31
+ click ( ) {
32
+ appWindow . show ( ) ;
33
+ } ,
32
34
} ,
33
35
{
34
- type : 'separator'
36
+ type : 'separator' ,
35
37
} ,
36
38
{
37
39
label : 'Quit' ,
38
40
accelerator : isDarwin ? 'Command+Q' : 'Alt+F4' ,
39
- role : 'quit'
40
- }
41
+ role : 'quit' ,
42
+ } ,
41
43
] ) ;
42
44
43
45
trayIcon . setToolTip ( 'GitHub Notifications on your menu bar.' ) ;
@@ -46,28 +48,33 @@ app.on('ready', function() {
46
48
}
47
49
48
50
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
+ }
60
66
}
61
- } ) ;
67
+ ) ;
62
68
}
63
69
64
70
function checkAutoUpdate ( showAlert ) {
65
-
66
- if ( isWindows || isLinux ) { return ; }
71
+ if ( isWindows || isLinux ) {
72
+ return ;
73
+ }
67
74
68
75
let autoUpdateOptions = {
69
76
repo : 'manosim/gitify' ,
70
- currentVersion : app . getVersion ( )
77
+ currentVersion : app . getVersion ( ) ,
71
78
} ;
72
79
73
80
const updater = new GhReleases ( autoUpdateOptions ) ;
@@ -92,7 +99,7 @@ app.on('ready', function() {
92
99
type : 'info' ,
93
100
buttons : [ 'Close' ] ,
94
101
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.' ,
96
103
} ) ;
97
104
}
98
105
}
@@ -103,7 +110,7 @@ app.on('ready', function() {
103
110
} ) ;
104
111
}
105
112
106
- function initWindow ( ) {
113
+ function initWindow ( ) {
107
114
let defaults = {
108
115
width : 500 ,
109
116
height : 600 ,
@@ -114,15 +121,15 @@ app.on('ready', function() {
114
121
fullscreenable : false ,
115
122
titleBarStyle : 'hidden-inset' ,
116
123
webPreferences : {
117
- overlayScrollbars : true
118
- }
124
+ overlayScrollbars : true ,
125
+ } ,
119
126
} ;
120
127
121
128
appWindow = new BrowserWindow ( defaults ) ;
122
129
appWindow . loadURL ( 'file://' + __dirname + '/index.html' ) ;
123
130
appWindow . show ( ) ;
124
131
125
- appWindow . on ( 'close' , function ( event ) {
132
+ appWindow . on ( 'close' , function ( event ) {
126
133
if ( ! isQuitting ) {
127
134
event . preventDefault ( ) ;
128
135
appWindow . hide ( ) ;
@@ -137,12 +144,12 @@ app.on('ready', function() {
137
144
appIcon = createAppIcon ( ) ;
138
145
initWindow ( ) ;
139
146
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 ) ) ;
144
151
ipcMain . on ( 'set-badge' , ( event , count ) => app . setBadgeCount ( count ) ) ;
145
- ipcMain . on ( 'app-quit' , ( ) => app . quit ( ) ) ;
152
+ ipcMain . on ( 'app-quit' , ( ) => app . quit ( ) ) ;
146
153
147
154
ipcMain . on ( 'update-icon' , ( event , arg ) => {
148
155
if ( ! appIcon . isDestroyed ( ) ) {
@@ -180,7 +187,7 @@ app.on('ready', function() {
180
187
} ) ;
181
188
} ) ;
182
189
183
- app . on ( 'activate' , ( ) => appWindow . show ( ) ) ;
190
+ app . on ( 'activate' , ( ) => appWindow . show ( ) ) ;
184
191
185
192
app . on ( 'window-all-closed' , ( ) => {
186
193
if ( ! isDarwin ) {
0 commit comments