Skip to content

Commit

Permalink
Merge pull request #7 from zonayedpca/v0.6.0-beta
Browse files Browse the repository at this point in the history
V0.6.0 beta
  • Loading branch information
zonayedpca authored Sep 9, 2019
2 parents 3710ae7 + 6cf5f10 commit bddf293
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 44 deletions.
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 4 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 12 additions & 0 deletions src/controller/autoLaunch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const AutoLaunch = require('auto-launch');

const autoLaunch = () => {
const devTopAutoLauncher = new AutoLaunch({
name: 'DevTop',
});
return devTopAutoLauncher;
};

module.exports = {
autoLaunch,
};
5 changes: 5 additions & 0 deletions src/controller/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { autoLaunch } = require('./autoLaunch');

module.exports = {
autoLaunch,
};
74 changes: 31 additions & 43 deletions src/module/ApplicationTray.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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() {
Expand Down Expand Up @@ -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...');
},
})
);
Expand Down

0 comments on commit bddf293

Please sign in to comment.