diff --git a/app.js b/app.js index bcbba9d..17f5a70 100644 --- a/app.js +++ b/app.js @@ -18,6 +18,7 @@ const iconName = const iconPath = path.join(__dirname, `./src/assets/img/${iconName}`); let mainWindow; +// eslint-disable-next-line no-unused-vars let tray; app.on('ready', () => { diff --git a/electron-builder.yml b/electron-builder.yml index f82c0aa..610f268 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -32,6 +32,10 @@ win: - ia32 publish: ['github'] +# Config for the windows installer +nsis: + oneClick: false + # Linux configuration linux: icon: 'src/assets/img/iconTemplate.png' diff --git a/package.json b/package.json index bace117..1dac58a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "devtop", - "version": "0.5.0", + "version": "0.6.0", "description": "DevTop - Essential Tools for Developers", "main": "app.js", "author": "Zonayed Ahmed", diff --git a/src/controller/autoLaunch.js b/src/controller/autoLaunch.js new file mode 100644 index 0000000..dada86a --- /dev/null +++ b/src/controller/autoLaunch.js @@ -0,0 +1,12 @@ +const AutoLaunch = require('auto-launch'); + +const autoLaunch = () => { + const devTopAutoLauncher = new AutoLaunch({ + name: 'DevTop', + }); + return devTopAutoLauncher; +}; + +module.exports = { + autoLaunch, +}; diff --git a/src/controller/index.js b/src/controller/index.js new file mode 100644 index 0000000..a84901d --- /dev/null +++ b/src/controller/index.js @@ -0,0 +1,5 @@ +const { autoLaunch } = require('./autoLaunch'); + +module.exports = { + autoLaunch, +}; diff --git a/src/module/ApplicationTray.js b/src/module/ApplicationTray.js index fcb88c1..2c74312 100644 --- a/src/module/ApplicationTray.js +++ b/src/module/ApplicationTray.js @@ -1,11 +1,7 @@ -const { app, Tray, Menu, MenuItem, dialog } = require('electron'); -const AutoLaunch = require('auto-launch'); +const { app, Tray, Menu, MenuItem } = require('electron'); const { getPosition } = require('../utils'); - -const devTopAutoLauncher = new AutoLaunch({ - name: 'DevTop', -}); +const { autoLaunch } = require('../controller'); class ApplicationTray extends Tray { constructor(iconPath, mainWindow) { @@ -19,33 +15,37 @@ class ApplicationTray extends Tray { } setAutoStart() { - devTopAutoLauncher.isEnabled().then(isEnabled => { - this.autoStart = isEnabled; - }); + autoLaunch() + .isEnabled() + .then(isEnabled => { + this.autoStart = isEnabled; + }); } toggleAutoLaunch() { - devTopAutoLauncher.isEnabled().then(isEnabled => { - if (isEnabled) { - devTopAutoLauncher - .disable() - .then(() => { - this.autoStart = false; - }) - .catch(err => { - console.log(err); - }); - } else { - devTopAutoLauncher - .enable() - .then(() => { - this.autoStart = true; - }) - .catch(err => { - console.log(err); - }); - } - }); + autoLaunch() + .isEnabled() + .then(isEnabled => { + if (isEnabled) { + autoLaunch() + .disable() + .then(() => { + this.autoStart = false; + }) + .catch(err => { + console.log(err); + }); + } else { + autoLaunch() + .enable() + .then(() => { + this.autoStart = true; + }) + .catch(err => { + console.log(err); + }); + } + }); } onClick() { @@ -82,19 +82,7 @@ class ApplicationTray extends Tray { label: 'Check for Updates', type: 'checkbox', click: () => { - const dialogOpts = { - type: 'info', - buttons: ['Ok', 'Cancel'], - title: 'Update is coming soon...', - message: 'DevTop Essential Update', - detail: - 'Automated update option is going to be implemented in future, please update manually for now.', - }; - dialog.showMessageBox(dialogOpts, response => { - if (response === 0) { - console.log('Dialog'); - } - }); + console.log('Update check will be implemented here...'); }, }) );