Skip to content

Commit

Permalink
Merge pull request #6 from zonayedpca/v0.5.0-beta
Browse files Browse the repository at this point in the history
V0.5.0 beta
  • Loading branch information
zonayedpca authored Sep 6, 2019
2 parents 9f960cc + 9547b2a commit 3710ae7
Show file tree
Hide file tree
Showing 9 changed files with 19,698 additions and 59 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ cache:
directories:
- node_modules
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then npm run pack fi
- if [ $TRAVIS_BRANCH == "master" ]; then npm run pack; fi
3 changes: 0 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { setScreenSize } = require('./src/config');

const MainWindow = require('./src/module/MainWindow');
const ApplicationTray = require('./src/module/ApplicationTray');
const AppUpdater = require('./src/module/AppUpdater');

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

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

let mainWindow;
let tray;
let updater;

app.on('ready', () => {
setScreenSize();
updater = new AppUpdater();
mainWindow = new MainWindow(
{
height: 420,
Expand Down
19,573 changes: 19,573 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
productName: 'DevTop'
appId: 'devtop.essential'
artifactName: ${productName}-${version}-${os}-${arch}.${ext}

# Package electron code into a asar archive. Set to false to debug issues.
asar: true
Expand All @@ -17,9 +18,18 @@ mac:
win:
icon: 'src/assets/img/windows-icon.png'
target:
- 'nsis'
- 'portable'
- 'zip'
- target: 'nsis'
arch:
- x64
- ia32
- target: 'portable'
arch:
- x64
- ia32
- target: 'zip'
arch:
- x64
- ia32
publish: ['github']

# Linux configuration
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "devtop",
"version": "0.4.0",
"version": "0.5.0",
"description": "DevTop - Essential Tools for Developers",
"main": "app.js",
"author": "Zonayed Ahmed",
"scripts": {
"preinstall": "cd client && npm install",
"preinstall": "cd client && yarn install",
"test-client": "npm run test --prefix client -- --watchAll=false",
"test": "npm run test-client",
"client": "npm start --prefix client",
Expand Down Expand Up @@ -43,6 +43,7 @@
"wait-on": "^3.3.0"
},
"dependencies": {
"auto-launch": "^5.0.5",
"electron-updater": "^4.1.2"
}
}
32 changes: 0 additions & 32 deletions src/module/AppUpdater.js

This file was deleted.

97 changes: 81 additions & 16 deletions src/module/ApplicationTray.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
const { app, Tray, Menu } = require('electron');
const { app, Tray, Menu, MenuItem, dialog } = require('electron');
const AutoLaunch = require('auto-launch');

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

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

class ApplicationTray extends Tray {
constructor(iconPath, mainWindow) {
super(iconPath);
this.mainWindow = mainWindow;
this.on('click', this.onClick.bind(this));
this.on('right-click', this.onRightClick.bind(this));
this.setToolTip('DevTop');
this.autoStart = false;
this.setAutoStart();
}

setAutoStart() {
devTopAutoLauncher.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);
});
}
});
}

onClick() {
Expand All @@ -23,26 +60,54 @@ class ApplicationTray extends Tray {
}

onRightClick() {
const menuConfig = Menu.buildFromTemplate([
{
label: 'DevTop',
},
{
label: 'Check for Updates',
},
{
const menu = new Menu();
menu.append(
new MenuItem({
label: 'DevTop Essentials',
})
);
menu.append(new MenuItem({ type: 'separator' }));
menu.append(
new MenuItem({
label: 'Start on Startup',
type: 'radio',
checked: true,
},
{
type: 'checkbox',
checked: this.autoStart,
click: () => {
this.toggleAutoLaunch();
},
})
);
menu.append(
new MenuItem({
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');
}
});
},
})
);
menu.append(new MenuItem({ type: 'separator' }));
menu.append(
new MenuItem({
label: 'Quit',
click: () => {
app.quit();
},
},
]);
this.popUpContextMenu(menuConfig);
})
);
this.popUpContextMenu(menu);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const getPosition = require('./getPosition');

module.exports = {
isDev,
getPosition
};
getPosition,
};
26 changes: 26 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ [email protected], app-builder-lib@~21.2.0:
semver "^6.3.0"
temp-file "^3.3.4"

applescript@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/applescript/-/applescript-1.0.0.tgz#bb87af568cad034a4e48c4bdaf6067a3a2701317"
integrity sha1-u4evVoytA0pOSMS9r2Bno6JwExc=

aproba@^1.0.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
Expand Down Expand Up @@ -299,6 +304,17 @@ atob@^2.1.1:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==

auto-launch@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/auto-launch/-/auto-launch-5.0.5.tgz#d14bd002b1ef642f85e991a6195ff5300c8ad3c0"
integrity sha512-ppdF4mihhYzMYLuCcx9H/c5TUOCev8uM7en53zWVQhyYAJrurd2bFZx3qQVeJKF2jrc7rsPRNN5cD+i23l6PdA==
dependencies:
applescript "^1.0.0"
mkdirp "^0.5.1"
path-is-absolute "^1.0.0"
untildify "^3.0.2"
winreg "1.2.4"

aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
Expand Down Expand Up @@ -3636,6 +3652,11 @@ unset-value@^1.0.0:
has-value "^0.3.1"
isobject "^3.0.0"

untildify@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==

unzip-response@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97"
Expand Down Expand Up @@ -3785,6 +3806,11 @@ widest-line@^2.0.0:
dependencies:
string-width "^2.1.1"

[email protected]:
version "1.2.4"
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
integrity sha1-ugZWKbepJRMOFXeRCM9UCZDpjRs=

wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
Expand Down

0 comments on commit 3710ae7

Please sign in to comment.