@@ -6,8 +6,7 @@ const isDev = require('electron-is-dev');
6
6
let BASE_URL = `file://${ __dirname } /app/index.html` ;
7
7
let SCHEME = 'blockphotosapp' ;
8
8
if ( isDev ) {
9
- // BASE_URL = 'http://localhost:9876';
10
-
9
+ // BASE_URL = 'http://localhost:9876';
11
10
}
12
11
13
12
protocol . registerStandardSchemes ( [ SCHEME ] ) ;
@@ -26,29 +25,38 @@ if (!gotTheLock) {
26
25
} else {
27
26
app . on ( 'second-instance' , ( event , commandLine ) => {
28
27
if ( mainWindow && commandLine [ 1 ] ) {
29
- if ( mainWindow . isMinimized ( ) ) {
30
- mainWindow . restore ( ) ;
31
- }
28
+ if ( mainWindow . isMinimized ( ) ) {
29
+ mainWindow . restore ( ) ;
30
+ }
31
+
32
+ mainWindow . close ( ) ;
33
+
34
+ mainWindow = new BrowserWindow ( {
35
+ width : 500 ,
36
+ height : 810 ,
37
+ icon : path . join ( __dirname , 'icons/png/64x64.png' )
38
+ } ) ;
32
39
33
- var request = commandLine [ 1 ] . split ( ":" ) ;
40
+ var request = commandLine [ 1 ] . split ( ':' ) ;
34
41
35
- if ( request [ 1 ] && currentAuthResponse !== request [ 1 ] ) {
36
- currentAuthResponse = request [ 1 ] ;
42
+ if ( request [ 1 ] && currentAuthResponse !== request [ 1 ] ) {
43
+ currentAuthResponse = request [ 1 ] ;
37
44
38
- mainWindow . focus ( ) ;
39
- mainWindow . loadURL ( BASE_URL + '?authResponse=' + request [ 1 ] ) ;
40
- return true ;
41
- }
45
+ mainWindow . focus ( ) ;
46
+ mainWindow . loadURL ( BASE_URL + '?authResponse=' + request [ 1 ] ) ;
47
+ return true ;
48
+ }
42
49
}
43
50
dialog . showMessageBox ( {
44
- message : " Authentication failed, please try again!" ,
45
- buttons : [ "OK" ]
51
+ message : ' Authentication failed, please try again!' ,
52
+ buttons : [ 'OK' ]
46
53
} ) ;
47
54
} ) ;
48
55
}
49
56
50
57
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
51
- if ( require ( 'electron-squirrel-startup' ) ) { // eslint-disable-line global-require
58
+ if ( require ( 'electron-squirrel-startup' ) ) {
59
+ // eslint-disable-line global-require
52
60
app . quit ( ) ;
53
61
}
54
62
@@ -81,31 +89,31 @@ const createWindow = () => {
81
89
app . on ( 'ready' , createWindow ) ;
82
90
83
91
// Quit when all windows are closed.
84
- app . on ( 'window-all-closed' , function ( ) {
92
+ app . on ( 'window-all-closed' , function ( ) {
85
93
// On OS X it is common for applications and their menu bar
86
94
// to stay active until the user quits explicitly with Cmd + Q
87
95
if ( process . platform !== 'darwin' ) {
88
96
app . quit ( ) ;
89
97
}
90
- } )
98
+ } ) ;
91
99
92
- app . on ( 'activate' , function ( ) {
100
+ app . on ( 'activate' , function ( ) {
93
101
// On OS X it's common to re-create a window in the app when the
94
102
// dock icon is clicked and there are no other windows open.
95
103
if ( mainWindow === null ) {
96
104
createWindow ( ) ;
97
105
}
98
- } )
106
+ } ) ;
99
107
100
- app . on ( 'open-url' , function ( event , url ) {
108
+ app . on ( 'open-url' , function ( event , url ) {
101
109
// On OS X it's common to re-create a window in the app when the
102
110
// dock icon is clicked and there are no other windows open.
103
111
if ( mainWindow ) {
104
112
if ( mainWindow . isMinimized ( ) ) {
105
113
mainWindow . restore ( ) ;
106
114
}
107
115
108
- var request = url . split ( ":" ) ;
116
+ var request = url . split ( ':' ) ;
109
117
110
118
if ( request [ 1 ] && currentAuthResponse !== request [ 1 ] ) {
111
119
currentAuthResponse = request [ 1 ] ;
@@ -116,10 +124,10 @@ app.on('open-url', function (event, url) {
116
124
}
117
125
}
118
126
dialog . showMessageBox ( {
119
- message : " Authentication failed, please try again!" ,
120
- buttons : [ "OK" ]
127
+ message : ' Authentication failed, please try again!' ,
128
+ buttons : [ 'OK' ]
121
129
} ) ;
122
- } )
130
+ } ) ;
123
131
124
132
// In this file you can include the rest of your app's specific main process
125
133
// code. You can also put them in separate files and require them here.
0 commit comments