Skip to content

Commit

Permalink
v3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Feb 25, 2017
1 parent 023eb34 commit fd3c27b
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ before_install:
- echo "Installing nvm"
- curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | NVM_DIR=$HOME/.nvm sh
- source $HOME/.nvm/nvm.sh
- nvm install 7.4.0
- nvm use 7.4.0
- nvm install 7.6.0
- nvm use 7.6.0

install:
- echo "Installing dependencies"
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ app.on('quit', () => {
logger.debug('application', 'App:quit');

logger.debug('application', 'settings', `settingsFilePath: '${settings.electronSettings.getSettingsFilePath()}'`);
logger.debug('application', 'settings', util.inspect(settings.electronSettings.getSync()));
logger.debug('application', 'settings', `${util.inspect(settings.electronSettings.getSync())}`);
});

/** @listens Electron.App#on */
Expand Down
20 changes: 18 additions & 2 deletions app/scripts/renderer/pushbullet/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ const defaultInterval = 1000;
let pb;


/**
* Get "pro" account status
* @return {Boolean} True if "pro" account
*/
let getAccountProStatus = () => {
logger.debug('clipboard', 'getProStatus()');

return Boolean(pb.account.pro);
};

/**
* Get 'pb-for-desktop' device
* @return {Array} Devices with model = 'pb-for-desktop'
Expand Down Expand Up @@ -163,6 +173,12 @@ let monitorClipboard = () => {
let initialize = () => {
logger.debug('clipboard', 'initializeClipboard()');

if (!getAccountProStatus()) {
logger.devtools('clipboard', '"pro" account not found');

return;
}

/**
* Receiver
* @listens window:Event#message
Expand All @@ -177,8 +193,8 @@ let initialize = () => {
logger.error('clipboard', 'addWSMessageHandler()', err);
}

let messageType = message.type,
pushObject = message.push;
let messageType = message.type;
let pushObject = message.push;

if (pushObject && messageType === 'push') {
if (pushObject.type && pushObject.type === 'clip') {
Expand Down
74 changes: 36 additions & 38 deletions app/scripts/renderer/pushbullet/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,22 @@ class PushbulletNotification {
silent: true
};

// Trigger native notification
// Trigger Notification
let notification = new Notification(options.title, options);

settings.electronSettings.get('soundEnabled')
.then(soundEnabled => {
if (soundEnabled === true) {
settings.electronSettings.get('soundFile').then(soundFile => {
playSoundFile(soundFile, function(err, file) {
if (err) {
logger.error('playSoundFile', file, err);
}
});
});
// Get sound setting
let soundEnabled = settings.getConfigurationItem('soundEnabled').get();

if (soundEnabled === true) {
// Get sound file
let soundFile = settings.getConfigurationItem('soundFile').get();

playSoundFile(soundFile, function(err, file) {
if (err) {
logger.error('playSoundFile', file, err);
}
});
}

/**
* @listens notification:PointerEvent#click´
Expand Down Expand Up @@ -347,38 +348,35 @@ let enqueuePushList = (pushesList, filterPushes, cb) => {
return callback(pushesList.length);
}

settings.electronSettings.get('lastNotification')
.then(lastNotification => {
let lastNotification = settings.getConfigurationItem('lastNotification').get();
let nextPushesList = pushesList;
let notifyAfter = lastNotification || 0;

let nextPushesList = pushesList;
let notifyAfter = lastNotification || 0;

// Remove pushes older than 'lastNotification' from array
if (filterPushes) {
nextPushesList = pushesList.filter(function(element) {
return (element.created) > notifyAfter;
});
}
// Remove pushes older than 'lastNotification' from array
if (filterPushes) {
nextPushesList = pushesList.filter(function(element) {
return (element.created) > notifyAfter;
});
}

nextPushesList.forEach(function(push, pushIndex) {
let notificationTimeout = setTimeout(function() {
nextPushesList.forEach(function(push, pushIndex) {
let notificationTimeout = setTimeout(function() {

// Show local notification
createPushbulletNotification(push);
// Show local notification
createPushbulletNotification(push);

if (push.created > notifyAfter) {
// Update 'lastNotification' with timestamp from most recent push
settings.getConfigurationItem('lastNotification').set(push.modified);
}
if (push.created > notifyAfter) {
// Update 'lastNotification' with timestamp from most recent push
settings.getConfigurationItem('lastNotification').set(push.modified);
}

// Callback
if (nextPushesList.length === (pushIndex + 1)) {
callback(nextPushesList.length);
clearTimeout(notificationTimeout);
}
}, (parseInt(notificationInterval) * (pushIndex + 1)), self);
}, self);
});
// Callback
if (nextPushesList.length === (pushIndex + 1)) {
callback(nextPushesList.length);
clearTimeout(notificationTimeout);
}
}, (parseInt(notificationInterval) * (pushIndex + 1)), self);
}, self);
};

/**
Expand Down
10 changes: 8 additions & 2 deletions app/scripts/renderer/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ webview.addEventListener('load-commit', (ev) => {
if (!parseDomain(ev.url)) { return; }

let domain = parseDomain(ev.url).domain || '';
let subdomain = parseDomain(ev.url).subdomain || '';
let path = url.parse(ev.url).path || '';

switch (domain) {
Expand All @@ -150,14 +151,19 @@ webview.addEventListener('load-commit', (ev) => {
body.style.backgroundColor = 'rgb(236, 240, 240)';
break;
case 'pushbullet':
dom.setVisibility(controls, false);
// Pushbullet 'help'
if (subdomain.includes('help')) {
dom.setVisibility(controls, true);
} else {
dom.setVisibility(controls, false);
}

// Pushbullet 'signin'
if (path.includes('signin')) {
body.style.backgroundColor = 'rgb(236, 240, 240)';
} else {
body.style.backgroundColor = 'transparent';
}
}

});

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pb-for-desktop",
"productName": "PB for Desktop",
"version": "3.8.0",
"version": "3.9.0",
"description": "PushBullet desktop application for macOS, Windows and Linux",
"license": "MIT",
"homepage": "https://sidneys.github.io/pb-for-desktop",
Expand Down Expand Up @@ -50,7 +50,7 @@
"babel-cli": "^6.23.0",
"babel-preset-electron": "^1.4.15",
"chalk": "^1.1.3",
"electron-compile": "^6.1.1",
"electron-compile": "^6.1.2",
"electron-compilers": "^5.5.1",
"electron-connect": "^0.6.1",
"electron-editor-context-menu": "^1.1.1",
Expand All @@ -65,8 +65,7 @@
"lodash": "^4.17.4",
"parse-domain": "^1.1.0",
"read-chunk": "^2.0.0",
"semver-compare": "^1.0.0",
"semver-regex": "^1.0.0"
"semver-compare": "^1.0.0"
},
"devDependencies": {
"electron": "^1.4.15",
Expand Down
Binary file added sounds/slack-1.wav
Binary file not shown.
Binary file added sounds/slack-2.wav
Binary file not shown.
Binary file added sounds/slack-3.wav
Binary file not shown.
Binary file added sounds/slack-4.wav
Binary file not shown.
Binary file added sounds/slack-5.wav
Binary file not shown.
Binary file added sounds/slack-6.wav
Binary file not shown.
Binary file added sounds/slack-7.wav
Binary file not shown.
Binary file added sounds/slack-8.wav
Binary file not shown.

0 comments on commit fd3c27b

Please sign in to comment.