diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | gui/packages/desktop/assets/images/icon-notification.png | bin | 0 -> 8365 bytes | |||
| -rw-r--r-- | gui/packages/desktop/src/main/notification-controller.ts | 23 |
3 files changed, 20 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bddac0e64..41439129c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Line wrap the file at 100 chars. Th ### Changed #### Linux - Increase `NetworkManager` DBus RPC timeout from 1 second to 3 seconds. +- Improve notification look by adding application name and icon. ## [2019.1] - 2019-01-29 diff --git a/gui/packages/desktop/assets/images/icon-notification.png b/gui/packages/desktop/assets/images/icon-notification.png Binary files differnew file mode 100644 index 0000000000..4f0b49935e --- /dev/null +++ b/gui/packages/desktop/assets/images/icon-notification.png diff --git a/gui/packages/desktop/src/main/notification-controller.ts b/gui/packages/desktop/src/main/notification-controller.ts index 86f23a8b4f..0ecad34566 100644 --- a/gui/packages/desktop/src/main/notification-controller.ts +++ b/gui/packages/desktop/src/main/notification-controller.ts @@ -1,4 +1,5 @@ -import { Notification, shell } from 'electron'; +import { app, nativeImage, NativeImage, Notification, shell } from 'electron'; +import path from 'path'; import config from '../config.json'; import { TunnelStateTransition } from '../shared/daemon-rpc-types'; @@ -8,6 +9,17 @@ export default class NotificationController { private reconnecting = false; private presentedNotifications: { [key: string]: boolean } = {}; private pendingNotifications: Notification[] = []; + private notificationTitle = process.platform === 'linux' ? app.getName() : ''; + private notificationIcon?: NativeImage; + + constructor() { + if (process.platform === 'linux') { + const basePath = path.resolve(path.join(__dirname, '../../assets/images')); + this.notificationIcon = nativeImage.createFromPath( + path.join(basePath, 'icon-notification.png'), + ); + } + } public notifyTunnelState(tunnelState: TunnelStateTransition) { switch (tunnelState.state) { @@ -52,9 +64,10 @@ export default class NotificationController { public notifyInconsistentVersion() { this.presentNotificationOnce('inconsistent-version', () => { const notification = new Notification({ - title: '', + title: this.notificationTitle, body: 'Inconsistent internal version information, please restart the app', silent: true, + icon: this.notificationIcon, }); this.scheduleNotification(notification); }); @@ -63,9 +76,10 @@ export default class NotificationController { public notifyUnsupportedVersion(upgradeVersion: string) { this.presentNotificationOnce('unsupported-version', () => { const notification = new Notification({ - title: '', + title: this.notificationTitle, body: `You are running an unsupported app version. Please upgrade to ${upgradeVersion} now to ensure your security`, silent: true, + icon: this.notificationIcon, }); notification.on('click', () => { @@ -91,9 +105,10 @@ export default class NotificationController { } const newNotification = new Notification({ - title: '', + title: this.notificationTitle, body: message, silent: true, + icon: this.notificationIcon, }); if (lastAnnouncement) { |
