@@ -39,6 +39,65 @@ class AppMenu {
3939 } ] ;
4040 }
4141
42+ getToolsSubmenu ( ) {
43+ return [ {
44+ label : `Check for Updates` ,
45+ click ( ) {
46+ AppMenu . checkForUpdate ( ) ;
47+ }
48+ } ,
49+ {
50+ label : `Release Notes` ,
51+ click ( ) {
52+ shell . openExternal ( `https://github.com/zulip/zulip-electron/releases/tag/v${ app . getVersion ( ) } ` ) ;
53+ }
54+ } , {
55+ type : 'separator'
56+ } , {
57+ label : 'Factory Reset' ,
58+ accelerator : process . platform === 'darwin' ? 'Command+Shift+D' : 'Ctrl+Shift+D' ,
59+ click ( ) {
60+ AppMenu . resetAppSettings ( ) ;
61+ }
62+ } , {
63+ label : 'Download App Logs' ,
64+ click ( ) {
65+ const zip = new AdmZip ( ) ;
66+ let date = new Date ( ) ;
67+ date = date . toLocaleDateString ( ) . replace ( / \/ / g, '-' ) ;
68+
69+ // Create a zip file of all the logs and config data
70+ zip . addLocalFolder ( `${ app . getPath ( 'appData' ) } /${ appName } /Logs` ) ;
71+ zip . addLocalFolder ( `${ app . getPath ( 'appData' ) } /${ appName } /config` ) ;
72+
73+ // Put the log file in downloads folder
74+ const logFilePath = `${ app . getPath ( 'downloads' ) } /Zulip-logs-${ date } .zip` ;
75+ zip . writeZip ( logFilePath ) ;
76+
77+ // Open and select the log file
78+ shell . showItemInFolder ( logFilePath ) ;
79+ }
80+ } , {
81+ type : 'separator'
82+ } , {
83+ label : 'Toggle DevTools for Zulip App' ,
84+ accelerator : process . platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I' ,
85+ click ( item , focusedWindow ) {
86+ if ( focusedWindow ) {
87+ focusedWindow . webContents . toggleDevTools ( ) ;
88+ }
89+ }
90+ } , {
91+ label : 'Toggle DevTools for Active Tab' ,
92+ accelerator : process . platform === 'darwin' ? 'Alt+Command+U' : 'Ctrl+Shift+U' ,
93+ click ( item , focusedWindow ) {
94+ if ( focusedWindow ) {
95+ AppMenu . sendAction ( 'tab-devtools' ) ;
96+ }
97+ }
98+ } ] ;
99+ }
100+
42101 getViewSubmenu ( ) {
43102 return [ {
44103 label : 'Reload' ,
@@ -103,22 +162,6 @@ class AppMenu {
103162 ConfigUtil . setConfigItem ( 'showSidebar' , newValue ) ;
104163 }
105164 }
106- } , {
107- label : 'Toggle DevTools for Zulip App' ,
108- accelerator : process . platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I' ,
109- click ( item , focusedWindow ) {
110- if ( focusedWindow ) {
111- focusedWindow . webContents . toggleDevTools ( ) ;
112- }
113- }
114- } , {
115- label : 'Toggle DevTools for Active Tab' ,
116- accelerator : process . platform === 'darwin' ? 'Alt+Command+U' : 'Ctrl+Shift+U' ,
117- click ( item , focusedWindow ) {
118- if ( focusedWindow ) {
119- AppMenu . sendAction ( 'tab-devtools' ) ;
120- }
121- }
122165 } ] ;
123166 }
124167
@@ -136,35 +179,11 @@ class AppMenu {
136179 }
137180 }
138181 } ,
139- {
140- label : `What's New` ,
141- click ( ) {
142- shell . openExternal ( `https://github.com/zulip/zulip-electron/releases/tag/v${ app . getVersion ( ) } ` ) ;
143- }
144- } ,
145182 {
146183 label : `Help Center` ,
147184 click ( ) {
148185 shell . openExternal ( 'https://zulipchat.com/help/' ) ;
149186 }
150- } , {
151- label : 'Download App Logs' ,
152- click ( ) {
153- const zip = new AdmZip ( ) ;
154- let date = new Date ( ) ;
155- date = date . toLocaleDateString ( ) . replace ( / \/ / g, '-' ) ;
156-
157- // Create a zip file of all the logs and config data
158- zip . addLocalFolder ( `${ app . getPath ( 'appData' ) } /${ appName } /Logs` ) ;
159- zip . addLocalFolder ( `${ app . getPath ( 'appData' ) } /${ appName } /config` ) ;
160-
161- // Put the log file in downloads folder
162- const logFilePath = `${ app . getPath ( 'downloads' ) } /Zulip-logs-${ date } .zip` ;
163- zip . writeZip ( logFilePath ) ;
164-
165- // Open and select the log file
166- shell . showItemInFolder ( logFilePath ) ;
167- }
168187 } , {
169188 label : 'Report an Issue' ,
170189 click ( ) {
@@ -218,13 +237,6 @@ class AppMenu {
218237 return [ {
219238 label : `${ app . getName ( ) } ` ,
220239 submenu : [ {
221- label : `Check for Updates` ,
222- click ( ) {
223- AppMenu . checkForUpdate ( ) ;
224- }
225- } , {
226- type : 'separator'
227- } , {
228240 label : 'Desktop Settings' ,
229241 accelerator : 'Cmd+,' ,
230242 click ( item , focusedWindow ) {
@@ -249,12 +261,6 @@ class AppMenu {
249261 const dndUtil = DNDUtil . toggle ( ) ;
250262 AppMenu . sendAction ( 'toggle-dnd' , dndUtil . dnd , dndUtil . newSettings ) ;
251263 }
252- } , {
253- label : 'Reset App Settings' ,
254- accelerator : 'Command+Shift+D' ,
255- click ( ) {
256- AppMenu . resetAppSettings ( ) ;
257- }
258264 } , {
259265 label : 'Log Out' ,
260266 accelerator : 'Cmd+L' ,
@@ -309,6 +315,9 @@ class AppMenu {
309315 } , {
310316 label : 'Window' ,
311317 submenu : this . getWindowSubmenu ( tabs , activeTabIndex )
318+ } , {
319+ label : 'Tools' ,
320+ submenu : this . getToolsSubmenu ( )
312321 } , {
313322 role : 'help' ,
314323 submenu : this . getHelpSubmenu ( )
@@ -321,13 +330,6 @@ class AppMenu {
321330 return [ {
322331 label : '&File' ,
323332 submenu : [ {
324- label : `Check for Updates` ,
325- click ( ) {
326- AppMenu . checkForUpdate ( ) ;
327- }
328- } , {
329- type : 'separator'
330- } , {
331333 label : 'Desktop Settings' ,
332334 accelerator : 'Ctrl+,' ,
333335 click ( item , focusedWindow ) {
@@ -354,12 +356,6 @@ class AppMenu {
354356 const dndUtil = DNDUtil . toggle ( ) ;
355357 AppMenu . sendAction ( 'toggle-dnd' , dndUtil . dnd , dndUtil . newSettings ) ;
356358 }
357- } , {
358- label : 'Reset App Settings' ,
359- accelerator : 'Ctrl+Shift+D' ,
360- click ( ) {
361- AppMenu . resetAppSettings ( ) ;
362- }
363359 } , {
364360 label : 'Log Out' ,
365361 accelerator : 'Ctrl+L' ,
@@ -404,6 +400,9 @@ class AppMenu {
404400 } , {
405401 label : '&Window' ,
406402 submenu : this . getWindowSubmenu ( tabs , activeTabIndex )
403+ } , {
404+ label : '&Tools' ,
405+ submenu : this . getToolsSubmenu ( )
407406 } , {
408407 label : '&Help' ,
409408 role : 'help' ,
0 commit comments