Skip to content

Commit

Permalink
v6.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Nov 16, 2017
1 parent 22c0ebd commit 86132f3
Show file tree
Hide file tree
Showing 12 changed files with 782 additions and 58 deletions.
12 changes: 12 additions & 0 deletions RELEASENOTES.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"6.5.1": {
"🍾 features": [
"Adds preference: application auto updates"
],
"🚨 fixed": [
"Fixes Notification Mirroring (#70)"
],
"👷 internals": [
"Upgrades `node_modules`",
"Upgrades `services`"
]
},
"6.5.0": {
"💎 improved": [
"Various stability and performance improvements"
Expand Down
Binary file added app/images/tray-item-appAutoUpdate-Template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 7 additions & 10 deletions app/scripts/main/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Node
* @constant
*/
const EventEmitter = require('events');
const events = require('events');
const path = require('path');

/**
Expand All @@ -24,21 +24,18 @@ const { app, BrowserWindow } = electron;
*/
const appRootPath = require('app-root-path');
const logger = require('@sidneys/logger')({ write: true });
const platformTools = require('@sidneys/platform-tools');

/**
* Modules
* Configuration
*/
EventEmitter.defaultMaxListeners = Infinity;
appRootPath.setPath(path.join(__dirname, '..', '..', '..', '..'));


/**
* App
* Configuration
*/
app.disableHardwareAcceleration();

appRootPath.setPath(path.join(__dirname, '..', '..', '..', '..'));
events.EventEmitter.defaultMaxListeners = Infinity;
if (platformTools.isLinux) {
process.env.XDG_CURRENT_DESKTOP = 'Unity';
}

/**
* Modules
Expand Down
53 changes: 36 additions & 17 deletions app/scripts/main/managers/configuration-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,27 @@ let setAppTrayOnly = (trayOnly) => {
*/
let configurationItems = {
/**
* Application changelog
* appAutoUpdate
*/
appAutoUpdate: {
keypath: 'appAutoUpdate',
default: false,
init() {
logger.debug(this.keypath, 'init');
},
get() {
logger.debug(this.keypath, 'get');

return electronSettings.get(this.keypath);
},
set(value) {
logger.debug(this.keypath, 'set');

electronSettings.set(this.keypath, value);
}
},
/**
* appChangelog
*/
appChangelog: {
keypath: 'appChangelog',
Expand All @@ -141,7 +161,7 @@ let configurationItems = {
}
},
/**
* Application's last version update
* appLastVersion
*/
appLastVersion: {
keypath: 'appLastVersion',
Expand All @@ -161,7 +181,7 @@ let configurationItems = {
}
},
/**
* Launch on startup
* appLaunchOnStartup
*/
appLaunchOnStartup: {
keypath: 'appLaunchOnStartup',
Expand Down Expand Up @@ -193,7 +213,7 @@ let configurationItems = {
}
},
/**
* Application log file
* appLogFile
*/
appLogFile: {
keypath: 'appLogFile',
Expand All @@ -213,7 +233,7 @@ let configurationItems = {
}
},
/**
* Show notification badge count (macOS)
* appShowBadgeCount
*/
appShowBadgeCount: {
keypath: 'appShowBadgeCount',
Expand Down Expand Up @@ -243,7 +263,7 @@ let configurationItems = {
}
},
/**
* Show application in menubar / taskbar only
* appTrayOnly
*/
appTrayOnly: {
keypath: 'appTrayOnly',
Expand Down Expand Up @@ -271,7 +291,7 @@ let configurationItems = {
}
},
/**
* Window bounds
* windowBounds
*/
windowBounds: {
keypath: 'windowBounds',
Expand Down Expand Up @@ -319,7 +339,7 @@ let configurationItems = {
}
},
/**
* Window always on top
* windowTopmost
*/
windowTopmost: {
keypath: 'windowTopmost',
Expand Down Expand Up @@ -358,7 +378,7 @@ let configurationItems = {
}
},
/**
* Window visibility
* windowVisible
*/
windowVisible: {
keypath: 'windowVisible',
Expand Down Expand Up @@ -407,7 +427,7 @@ let configurationItems = {
}
},
/**
* Hide notification message body
* pushbulletHideNotificationBody
*/
pushbulletHideNotificationBody: {
keypath: 'pushbulletHideNotificationBody',
Expand All @@ -427,7 +447,7 @@ let configurationItems = {
}
},
/**
* Last notification timestamp
* pushbulletLastNotificationTimestamp
*/
pushbulletLastNotificationTimestamp: {
keypath: 'pushbulletLastNotificationTimestamp',
Expand All @@ -447,7 +467,7 @@ let configurationItems = {
}
},
/**
* Repeat recent pushes on launch
* pushbulletRepeatRecentNotifications
*/
pushbulletRepeatRecentNotifications: {
keypath: 'pushbulletRepeatRecentNotifications',
Expand All @@ -467,7 +487,7 @@ let configurationItems = {
}
},
/**
* Notification sound on / off
* pushbulletSoundEnabled
*/
pushbulletSoundEnabled: {
keypath: 'pushbulletSoundEnabled',
Expand All @@ -486,9 +506,8 @@ let configurationItems = {
electronSettings.set(this.keypath, value);
}
},
/** @namespace fs.existsSync */
/**
* Notification sound file
* pushbulletSoundFile
*/
pushbulletSoundFile: {
keypath: 'pushbulletSoundFile',
Expand All @@ -511,7 +530,7 @@ let configurationItems = {
}
},
/**
* Notification sound volume
* pushbulletSoundVolume
*/
pushbulletSoundVolume: {
keypath: 'pushbulletSoundVolume',
Expand All @@ -531,7 +550,7 @@ let configurationItems = {
}
},
/**
* Mirrored SMS
* pushbulletSmsEnabled
*/
pushbulletSmsEnabled: {
keypath: 'pushbulletSmsEnabled',
Expand Down
18 changes: 17 additions & 1 deletion app/scripts/main/menus/tray-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const trayIconTransparentPause = path.join(appRootPath, 'app', 'images', `${plat
* Tray images
* @constant
*/
const trayMenuItemImageAppAutoUpdate = path.join(appRootPath, 'app', 'images', `tray-item-appAutoUpdate${platformTools.menuItemImageExtension}`);
const trayMenuItemImageAppLaunchOnStartup = path.join(appRootPath, 'app', 'images', `tray-item-appLaunchOnStartup${platformTools.menuItemImageExtension}`);
const trayMenuItemImageAppShowBadgeCount = path.join(appRootPath, 'app', 'images', `tray-item-appShowBadgeCount${platformTools.menuItemImageExtension}`);
const trayMenuItemImageAppTrayOnly = path.join(appRootPath, 'app', 'images', `tray-item-appTrayOnly${platformTools.menuItemImageExtension}`);
Expand Down Expand Up @@ -110,6 +111,19 @@ let createTrayMenuTemplate = () => {
{
type: 'separator'
},
{
id: 'appAutoUpdate',
label: 'Automatic App Updates',
icon: trayMenuItemImageAppAutoUpdate,
type: 'checkbox',
checked: configurationManager('appAutoUpdate').get(),
click(menuItem) {
configurationManager('appAutoUpdate').set(menuItem.checked);
}
},
{
type: 'separator'
},
{
id: 'reset',
label: 'Reset Configuration...',
Expand Down Expand Up @@ -342,9 +356,11 @@ let createTrayMenuTemplate = () => {
class TrayMenu extends Tray {
/**
* @param {Electron.MenuItemConstructorOptions[]} template - Menu template
* @constructs
* @constructor
*/
constructor(template) {
logger.debug('constructor');

super(trayIconDefault);

this.template = template;
Expand Down
63 changes: 49 additions & 14 deletions app/scripts/main/services/updater-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,32 @@ let getMainWindow = () => global.mainWindow;


/**
* Retrieve AppChangelog
* Retrieve appAutoUpdate
* @return {Boolean} - Yes / no
*/
let retrieveAppAutoUpdate = () => configurationManager('appAutoUpdate').get();

/**
* Retrieve appChangelog
* @return {String} - changelog
*/
let retrieveAppChangelog = () => configurationManager('appChangelog').get();

/**
* Store AppChangelog
* Store appChangelog
* @param {String} changelog - Changelog
* @return {void}
*/
let storeAppChangelog = (changelog) => configurationManager('appChangelog').set(changelog);

/**
* Retrieve AppLastVersion
* Retrieve appLastVersion
* @return {String} - Version
*/
let retrieveAppLastVersion = () => configurationManager('appLastVersion').get();

/**
* Store AppLastVersion
* Store appLastVersion
* @param {String} version - Version
* @return {void}
*/
Expand All @@ -88,9 +94,11 @@ let storeAppLastVersion = (version) => configurationManager('appLastVersion').se
*/
class UpdaterService {
/**
* @constructs
* @constructor
*/
constructor() {
logger.debug('constructor');

// Do not run with debug Electron application
if (process.defaultApp) { return; }

Expand Down Expand Up @@ -216,7 +224,7 @@ class UpdaterService {
});
});

this.autoUpdater.checkForUpdates();
this.checkForUpdates();
}

/**
Expand Down Expand Up @@ -253,7 +261,40 @@ class UpdaterService {
const notification = notificationProvider.create({ title: `Update installed for ${appProductName}`, subtitle: appCurrentVersion });
notification.show();
}
}

/**
* Check if updater is ready
* @return {Boolean} - Yes / no
*/
isAvailable() {
logger.debug('isAvailable');

return Boolean(this.autoUpdater);
}

/**
* Check if currently updating
* @return {Boolean} - Yes / no
*/
isActive() {
logger.debug('isActive');

return Boolean(this.isUpdating);
}

/**
* Check for updates
*/
checkForUpdates() {
logger.debug('checkForUpdates');

if (!this.isAvailable()) { return; }
if (this.isActive()) { return; }

if (!retrieveAppAutoUpdate()) { return; }

this.autoUpdater.checkForUpdates();
}
}

Expand All @@ -277,15 +318,9 @@ let init = () => {
app.on('browser-window-focus', () => {
logger.debug('app#browser-window-focus');

if (!global.updaterService) { init(); }
if (!global.updaterService) { return; }

if (!global.updaterService.autoUpdater) { return; }

if (Boolean(global.updaterService.isUpdating) === false) {
if (global.updaterService.autoUpdater.checkForUpdates) {
global.updaterService.autoUpdater.checkForUpdates();
}
}
global.updaterService.checkForUpdates();
});

/**
Expand Down
Loading

0 comments on commit 86132f3

Please sign in to comment.