Skip to content

Commit 3710ae7

Browse files
authored
Merge pull request #6 from zonayedpca/v0.5.0-beta
V0.5.0 beta
2 parents 9f960cc + 9547b2a commit 3710ae7

File tree

9 files changed

+19698
-59
lines changed

9 files changed

+19698
-59
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ cache:
99
directories:
1010
- node_modules
1111
after_success:
12-
- if [ "$TRAVIS_BRANCH" == "master" ]; then npm run pack fi
1312
- if [ $TRAVIS_BRANCH == "master" ]; then npm run pack; fi

app.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const { setScreenSize } = require('./src/config');
55

66
const MainWindow = require('./src/module/MainWindow');
77
const ApplicationTray = require('./src/module/ApplicationTray');
8-
const AppUpdater = require('./src/module/AppUpdater');
98

109
const { clipboard, code } = require('./src/service');
1110

@@ -20,11 +19,9 @@ const iconPath = path.join(__dirname, `./src/assets/img/${iconName}`);
2019

2120
let mainWindow;
2221
let tray;
23-
let updater;
2422

2523
app.on('ready', () => {
2624
setScreenSize();
27-
updater = new AppUpdater();
2825
mainWindow = new MainWindow(
2926
{
3027
height: 420,

client/package-lock.json

Lines changed: 19573 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

electron-builder.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
productName: 'DevTop'
22
appId: 'devtop.essential'
3+
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
34

45
# Package electron code into a asar archive. Set to false to debug issues.
56
asar: true
@@ -17,9 +18,18 @@ mac:
1718
win:
1819
icon: 'src/assets/img/windows-icon.png'
1920
target:
20-
- 'nsis'
21-
- 'portable'
22-
- 'zip'
21+
- target: 'nsis'
22+
arch:
23+
- x64
24+
- ia32
25+
- target: 'portable'
26+
arch:
27+
- x64
28+
- ia32
29+
- target: 'zip'
30+
arch:
31+
- x64
32+
- ia32
2333
publish: ['github']
2434

2535
# Linux configuration

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "devtop",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "DevTop - Essential Tools for Developers",
55
"main": "app.js",
66
"author": "Zonayed Ahmed",
77
"scripts": {
8-
"preinstall": "cd client && npm install",
8+
"preinstall": "cd client && yarn install",
99
"test-client": "npm run test --prefix client -- --watchAll=false",
1010
"test": "npm run test-client",
1111
"client": "npm start --prefix client",
@@ -43,6 +43,7 @@
4343
"wait-on": "^3.3.0"
4444
},
4545
"dependencies": {
46+
"auto-launch": "^5.0.5",
4647
"electron-updater": "^4.1.2"
4748
}
4849
}

src/module/AppUpdater.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/module/ApplicationTray.js

Lines changed: 81 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
const { app, Tray, Menu } = require('electron');
1+
const { app, Tray, Menu, MenuItem, dialog } = require('electron');
2+
const AutoLaunch = require('auto-launch');
23

34
const { getPosition } = require('../utils');
45

6+
const devTopAutoLauncher = new AutoLaunch({
7+
name: 'DevTop',
8+
});
9+
510
class ApplicationTray extends Tray {
611
constructor(iconPath, mainWindow) {
712
super(iconPath);
813
this.mainWindow = mainWindow;
914
this.on('click', this.onClick.bind(this));
1015
this.on('right-click', this.onRightClick.bind(this));
1116
this.setToolTip('DevTop');
17+
this.autoStart = false;
18+
this.setAutoStart();
19+
}
20+
21+
setAutoStart() {
22+
devTopAutoLauncher.isEnabled().then(isEnabled => {
23+
this.autoStart = isEnabled;
24+
});
25+
}
26+
27+
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+
});
1249
}
1350

1451
onClick() {
@@ -23,26 +60,54 @@ class ApplicationTray extends Tray {
2360
}
2461

2562
onRightClick() {
26-
const menuConfig = Menu.buildFromTemplate([
27-
{
28-
label: 'DevTop',
29-
},
30-
{
31-
label: 'Check for Updates',
32-
},
33-
{
63+
const menu = new Menu();
64+
menu.append(
65+
new MenuItem({
66+
label: 'DevTop Essentials',
67+
})
68+
);
69+
menu.append(new MenuItem({ type: 'separator' }));
70+
menu.append(
71+
new MenuItem({
3472
label: 'Start on Startup',
35-
type: 'radio',
36-
checked: true,
37-
},
38-
{
73+
type: 'checkbox',
74+
checked: this.autoStart,
75+
click: () => {
76+
this.toggleAutoLaunch();
77+
},
78+
})
79+
);
80+
menu.append(
81+
new MenuItem({
82+
label: 'Check for Updates',
83+
type: 'checkbox',
84+
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+
});
98+
},
99+
})
100+
);
101+
menu.append(new MenuItem({ type: 'separator' }));
102+
menu.append(
103+
new MenuItem({
39104
label: 'Quit',
40105
click: () => {
41106
app.quit();
42107
},
43-
},
44-
]);
45-
this.popUpContextMenu(menuConfig);
108+
})
109+
);
110+
this.popUpContextMenu(menu);
46111
}
47112
}
48113

src/utils/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const getPosition = require('./getPosition');
33

44
module.exports = {
55
isDev,
6-
getPosition
7-
};
6+
getPosition,
7+
};

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ [email protected], app-builder-lib@~21.2.0:
212212
semver "^6.3.0"
213213
temp-file "^3.3.4"
214214

215+
applescript@^1.0.0:
216+
version "1.0.0"
217+
resolved "https://registry.yarnpkg.com/applescript/-/applescript-1.0.0.tgz#bb87af568cad034a4e48c4bdaf6067a3a2701317"
218+
integrity sha1-u4evVoytA0pOSMS9r2Bno6JwExc=
219+
215220
aproba@^1.0.3:
216221
version "1.2.0"
217222
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
@@ -299,6 +304,17 @@ atob@^2.1.1:
299304
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
300305
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
301306

307+
auto-launch@^5.0.5:
308+
version "5.0.5"
309+
resolved "https://registry.yarnpkg.com/auto-launch/-/auto-launch-5.0.5.tgz#d14bd002b1ef642f85e991a6195ff5300c8ad3c0"
310+
integrity sha512-ppdF4mihhYzMYLuCcx9H/c5TUOCev8uM7en53zWVQhyYAJrurd2bFZx3qQVeJKF2jrc7rsPRNN5cD+i23l6PdA==
311+
dependencies:
312+
applescript "^1.0.0"
313+
mkdirp "^0.5.1"
314+
path-is-absolute "^1.0.0"
315+
untildify "^3.0.2"
316+
winreg "1.2.4"
317+
302318
aws-sign2@~0.7.0:
303319
version "0.7.0"
304320
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@@ -3636,6 +3652,11 @@ unset-value@^1.0.0:
36363652
has-value "^0.3.1"
36373653
isobject "^3.0.0"
36383654

3655+
untildify@^3.0.2:
3656+
version "3.0.3"
3657+
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
3658+
integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==
3659+
36393660
unzip-response@^2.0.1:
36403661
version "2.0.1"
36413662
resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97"
@@ -3785,6 +3806,11 @@ widest-line@^2.0.0:
37853806
dependencies:
37863807
string-width "^2.1.1"
37873808

3809+
3810+
version "1.2.4"
3811+
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
3812+
integrity sha1-ugZWKbepJRMOFXeRCM9UCZDpjRs=
3813+
37883814
wordwrap@~1.0.0:
37893815
version "1.0.0"
37903816
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"

0 commit comments

Comments
 (0)