1- const { app, Tray, Menu, MenuItem, dialog } = require ( 'electron' ) ;
2- const AutoLaunch = require ( 'auto-launch' ) ;
1+ const { app, Tray, Menu, MenuItem } = require ( 'electron' ) ;
32
43const { getPosition } = require ( '../utils' ) ;
5-
6- const devTopAutoLauncher = new AutoLaunch ( {
7- name : 'DevTop' ,
8- } ) ;
4+ const { autoLaunch } = require ( '../controller' ) ;
95
106class ApplicationTray extends Tray {
117 constructor ( iconPath , mainWindow ) {
@@ -19,33 +15,37 @@ class ApplicationTray extends Tray {
1915 }
2016
2117 setAutoStart ( ) {
22- devTopAutoLauncher . isEnabled ( ) . then ( isEnabled => {
23- this . autoStart = isEnabled ;
24- } ) ;
18+ autoLaunch ( )
19+ . isEnabled ( )
20+ . then ( isEnabled => {
21+ this . autoStart = isEnabled ;
22+ } ) ;
2523 }
2624
2725 toggleAutoLaunch ( ) {
28- devTopAutoLauncher . isEnabled ( ) . then ( isEnabled => {
29- if ( isEnabled ) {
30- devTopAutoLauncher
31- . disable ( )
32- . then ( ( ) => {
33- this . autoStart = false ;
34- } )
35- . catch ( err => {
36- console . log ( err ) ;
37- } ) ;
38- } else {
39- devTopAutoLauncher
40- . enable ( )
41- . then ( ( ) => {
42- this . autoStart = true ;
43- } )
44- . catch ( err => {
45- console . log ( err ) ;
46- } ) ;
47- }
48- } ) ;
26+ autoLaunch ( )
27+ . isEnabled ( )
28+ . then ( isEnabled => {
29+ if ( isEnabled ) {
30+ autoLaunch ( )
31+ . disable ( )
32+ . then ( ( ) => {
33+ this . autoStart = false ;
34+ } )
35+ . catch ( err => {
36+ console . log ( err ) ;
37+ } ) ;
38+ } else {
39+ autoLaunch ( )
40+ . enable ( )
41+ . then ( ( ) => {
42+ this . autoStart = true ;
43+ } )
44+ . catch ( err => {
45+ console . log ( err ) ;
46+ } ) ;
47+ }
48+ } ) ;
4949 }
5050
5151 onClick ( ) {
@@ -82,19 +82,7 @@ class ApplicationTray extends Tray {
8282 label : 'Check for Updates' ,
8383 type : 'checkbox' ,
8484 click : ( ) => {
85- const dialogOpts = {
86- type : 'info' ,
87- buttons : [ 'Ok' , 'Cancel' ] ,
88- title : 'Update is coming soon...' ,
89- message : 'DevTop Essential Update' ,
90- detail :
91- 'Automated update option is going to be implemented in future, please update manually for now.' ,
92- } ;
93- dialog . showMessageBox ( dialogOpts , response => {
94- if ( response === 0 ) {
95- console . log ( 'Dialog' ) ;
96- }
97- } ) ;
85+ console . log ( 'Update check will be implemented here...' ) ;
9886 } ,
9987 } )
10088 ) ;
0 commit comments