diff --git a/.travis.yml b/.travis.yml index b3d32eec..927a83f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/app/scripts/components/application.js b/app/scripts/components/application.js index ec8a6a1c..80dd50c0 100755 --- a/app/scripts/components/application.js +++ b/app/scripts/components/application.js @@ -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 */ diff --git a/app/scripts/renderer/pushbullet/clipboard.js b/app/scripts/renderer/pushbullet/clipboard.js index 96d91502..94482dfe 100644 --- a/app/scripts/renderer/pushbullet/clipboard.js +++ b/app/scripts/renderer/pushbullet/clipboard.js @@ -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' @@ -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 @@ -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') { diff --git a/app/scripts/renderer/pushbullet/push.js b/app/scripts/renderer/pushbullet/push.js index 47d17c58..bc82a6f1 100644 --- a/app/scripts/renderer/pushbullet/push.js +++ b/app/scripts/renderer/pushbullet/push.js @@ -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´ @@ -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); }; /** diff --git a/app/scripts/renderer/webview.js b/app/scripts/renderer/webview.js index 2b07da98..520d54cc 100644 --- a/app/scripts/renderer/webview.js +++ b/app/scripts/renderer/webview.js @@ -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) { @@ -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'; } } - }); diff --git a/package.json b/package.json index 61e0071a..258d6951 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", diff --git a/sounds/slack-1.wav b/sounds/slack-1.wav new file mode 100644 index 00000000..427035bd Binary files /dev/null and b/sounds/slack-1.wav differ diff --git a/sounds/slack-2.wav b/sounds/slack-2.wav new file mode 100644 index 00000000..7a3b85e7 Binary files /dev/null and b/sounds/slack-2.wav differ diff --git a/sounds/slack-3.wav b/sounds/slack-3.wav new file mode 100644 index 00000000..4556e89d Binary files /dev/null and b/sounds/slack-3.wav differ diff --git a/sounds/slack-4.wav b/sounds/slack-4.wav new file mode 100644 index 00000000..d478af4d Binary files /dev/null and b/sounds/slack-4.wav differ diff --git a/sounds/slack-5.wav b/sounds/slack-5.wav new file mode 100644 index 00000000..5fe41561 Binary files /dev/null and b/sounds/slack-5.wav differ diff --git a/sounds/slack-6.wav b/sounds/slack-6.wav new file mode 100644 index 00000000..f5a21257 Binary files /dev/null and b/sounds/slack-6.wav differ diff --git a/sounds/slack-7.wav b/sounds/slack-7.wav new file mode 100644 index 00000000..31135bf1 Binary files /dev/null and b/sounds/slack-7.wav differ diff --git a/sounds/slack-8.wav b/sounds/slack-8.wav new file mode 100644 index 00000000..ee303eb3 Binary files /dev/null and b/sounds/slack-8.wav differ