Skip to content

Commit

Permalink
v6.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Oct 23, 2017
1 parent 6845938 commit 9cd8db4
Show file tree
Hide file tree
Showing 19 changed files with 520 additions and 231 deletions.
24 changes: 24 additions & 0 deletions .jsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc"]
},
"source": {
"include": ["app", "lib", "package.json", "README.md"],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
"useLongnameInNav": false,
"showInheritedInNav": true
},
"opts": {
"destination": "./docs/",
"encoding": "utf8",
"private": true,
"recurse": true,
"template": "./node_modules/minami"
}
}
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Use tags to add emoji to notifications, e.g.: add `{video}` to show a 📺 with
1. [Installation](#installation)
1. [Developers](#development)
1. [Continuous Integration](#continuous-integration)
1. [Up Next](#up-next)
1. [Contact](#contact)
1. [Roadmap](#roadmap)
1. [Contribute](#contribute)
1. [Author](#author)


Expand Down Expand Up @@ -219,20 +219,25 @@ Backed by the open-source-friendly guys at [Travis](http://travis-ci.org/) and A
1. There is no step 3


## <a name="up-next"/></a> Roadmap
## <a name="roadmap"/></a> Roadmap

- [ ] Signed binaries
- [ ] End-To-End Tests (see [Spectron](https://github.com/electron/spectron))


## <a name="contribute"/></a> Contact ![Contributions Wanted](https://img.shields.io/badge/contributions-wanted-red.svg?style=flat-square)
## <a name="contribute"/></a> Contribute ![Contributions Wanted](https://img.shields.io/badge/contributions-wanted-red.svg?style=flat-square)

Read the [contribution documentation](https://github.com/sidneys/pb-for-desktop/blob/master/CONTRIBUTING.md) first.

- [Dev Chat](http://gitter.im/sidneys/pb-for-desktop): Talk about features and suggestions.
- [Issues](http;//github.com/sidneys/pb-for-desktop/issues) File bugs and document issues.


## <a name="license"/></a> License

MIT


## <a name="author"/></a> Author

[sidneys](http://sidneys.github.io) 2017
Expand Down
18 changes: 17 additions & 1 deletion RELEASENOTES.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"6.1.1": {
"6.2.0": {
"💎 improved": [
"Augments start-up & background resource usage (#67)",
"Simplified network reachability detection & on-/offline handling"
],
"🚨 fixed": [
"Fixes snooze wake-up scheduler",
"Fixes static snooze tray item display state",
"Fixes markdown release note formatting"
],
"👷 internals": [
"Upgrades `node_modules`",
"Upgrades `services`",
"Upgrades `lib`"
]
},
"6.1.7": {
"🍾 features": [
"Adds improved `webview` user interface controls",
"Updated sound file support: `.m4a`, `.mp3`, `.mp4`, `.ogg`, `.wav`"
Expand Down
60 changes: 33 additions & 27 deletions app/scripts/main/managers/configuration-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ const appSoundDirectory = path.join(appRootPath, 'sounds').replace('app.asar', '
* @default
*/
const defaultInterval = 1000;
const defaultDebounce = 300;
const defaultDebounce = 1000;


/**
* Get mainWindow
* @returns {Electron.BrowserWindow}
* Get primary BrowserWindow
* @returns {BrowserWindow}
*/
let getMainWindow = () => global.mainWindow;
let getPrimaryWindow = () => global.mainWindow;

/**
* Show app in menubar or task bar only
Expand All @@ -89,8 +89,10 @@ let setAppTrayOnly = (trayOnly) => {
logger.debug('setAppTrayOnly');

let interval = setInterval(() => {
const mainWindow = getMainWindow();
if (!mainWindow) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }


switch (platformHelper.type) {
case 'darwin':
Expand All @@ -99,10 +101,10 @@ let setAppTrayOnly = (trayOnly) => {
} else { app.dock.show(); }
break;
case 'win32':
mainWindow.setSkipTaskbar(trayOnly);
primaryWindow.setSkipTaskbar(trayOnly);
break;
case 'linux':
mainWindow.setSkipTaskbar(trayOnly);
primaryWindow.setSkipTaskbar(trayOnly);
break;
}

Expand Down Expand Up @@ -276,13 +278,13 @@ let configurationItems = {

// Wait for window
let interval = setInterval(() => {
const mainWindow = getMainWindow();
if (!mainWindow) { return; }
if (!mainWindow.getBounds()) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }

// Observe future changes
mainWindow.on('move', event => this.set(event.sender.getBounds()));
mainWindow.on('resize', event => this.set(event.sender.getBounds()));
primaryWindow.on('move', event => this.set(event.sender.getBounds()));
primaryWindow.on('resize', event => this.set(event.sender.getBounds()));

// Apply saved value
this.implement(this.get());
Expand All @@ -296,20 +298,21 @@ let configurationItems = {
return electronSettings.get(this.keypath);
},
set(value) {
logger.debug(this.keypath, 'set', util.inspect(value));
logger.debug(this.keypath, 'set', value);

let debounced = _.debounce(() => {
electronSettings.set(this.keypath, value);
}, defaultDebounce);
debounced();
},
implement(value) {
logger.debug(this.keypath, 'implement', util.inspect(value));
logger.debug(this.keypath, 'implement', value);

const mainWindow = getMainWindow();
if (!mainWindow) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }

mainWindow.setBounds(value);
primaryWindow.setBounds(value);
}
},
/**
Expand All @@ -323,8 +326,9 @@ let configurationItems = {

// Wait for window
let interval = setInterval(() => {
const mainWindow = getMainWindow();
if (!mainWindow) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }

this.implement(this.get());

Expand Down Expand Up @@ -361,12 +365,13 @@ let configurationItems = {

// Wait for window
let interval = setInterval(() => {
const mainWindow = getMainWindow();
if (!mainWindow) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }

// Observe future changes
mainWindow.on('show', event => this.set(event.sender.isVisible()));
mainWindow.on('hide', event => this.set(event.sender.isVisible()));
primaryWindow.on('hide', () => this.set(false));
primaryWindow.on('show', () => this.set(true));

// Apply saved value
this.implement(this.get());
Expand All @@ -391,10 +396,11 @@ let configurationItems = {
implement(value) {
logger.debug(this.keypath, 'implement', value);

const mainWindow = getMainWindow();
if (!mainWindow) { return; }
const primaryWindow = getPrimaryWindow();
if (!primaryWindow) { return; }
if (!primaryWindow.getBounds()) { return; }

value === true ? mainWindow.show() : mainWindow.hide();
value === true ? primaryWindow.show() : primaryWindow.hide();
}
},
/**
Expand Down
36 changes: 18 additions & 18 deletions app/scripts/main/menus/tray-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,27 +294,27 @@ let createTrayMenuTemplate = () => {
icon: trayMenuItemImageSnooze,
submenu: [
{
label: 'Snooze for 1 Hour',
label: '1 hour snooze',
id: 'snooze-60',
type: 'checkbox',
click(menuItem) {
getSnoozerService().snooze(menuItem, 1);
getSnoozerService().startSnooze(60, menuItem);
}
},
{
label: 'Snooze for 4 Hours',
label: '4 hour snooze',
id: 'snooze-240',
type: 'checkbox',
click(menuItem) {
getSnoozerService().snooze(menuItem, 240);
getSnoozerService().startSnooze(240, menuItem);
}
},
{
label: 'Snooze for 8 Hours',
label: '8 hour snooze',
id: 'snooze-480',
type: 'checkbox',
click(menuItem) {
getSnoozerService().snooze(menuItem, 480);
getSnoozerService().startSnooze(480, menuItem);
}
}
]
Expand Down Expand Up @@ -379,28 +379,28 @@ class TrayMenu extends Tray {
});

/**
* @listens ipcMain#networkState
* @listens ipcMain
*/
ipcMain.on('network', (event, networkState) => {
logger.debug('ipcMain#network');
ipcMain.on('online', (event, isOnline) => {
logger.debug('ipcMain#online', 'isOnline', isOnline);

switch (networkState) {
case 'offline':
this.setImageName('transparent');
break;
case 'online':
switch (isOnline) {
case true:
this.setImageName('default');
break;
case false:
this.setImageName('transparent');
break;
}
});

/**
* @listens ipcMain#snooze
* @listens ipcMain:
*/
ipcMain.on('snooze', (event, snoozeState) => {
logger.debug('ipcMain#snooze');
ipcMain.on('snooze', (event, isSnoozing) => {
logger.debug('ipcMain#snooze', 'isSnoozing', isSnoozing);

switch (snoozeState) {
switch (isSnoozing) {
case true:
this.setImageName('transparent-pause');
break;
Expand Down
11 changes: 1 addition & 10 deletions app/scripts/main/providers/notification-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Node
* @constant
*/
const os = require('os');
const path = require('path');

/**
Expand All @@ -31,16 +30,8 @@ const appRootPath = require('app-root-path')['path'];
* @constant
*/
const logger = require(path.join(appRootPath, 'lib', 'logger'))({ write: true });
const platformHelper = require(path.join(appRootPath, 'lib', 'platform-helper'));


/**
* Application
* @constant
* @default
*/
const appName = global.manifest.name;

/**
* Notification defaults
* @constant
Expand All @@ -55,7 +46,7 @@ const defaultOptions = {
/**
* Create
* @param {Object|String|Number} options - Notification Options
* @return {Electron.Notification|ToastNotification} - Native Notification
* @return {Notification} - Native Notification
*/
let create = (options) => {
logger.debug('create');
Expand Down
Loading

0 comments on commit 9cd8db4

Please sign in to comment.