diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-11-30 11:59:53 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-09 10:39:26 +0100 |
| commit | 9bc388cd020d0e4fc675e02b20522f31c2464885 (patch) | |
| tree | d61f78e0b279aa6207415feb40d6529478098eb7 /gui/src/main/notification-controller.ts | |
| parent | 4dc8fe0cc75ca0b65c10bf05002d5ab8b0fe0e0b (diff) | |
| download | mullvadvpn-9bc388cd020d0e4fc675e02b20522f31c2464885.tar.xz mullvadvpn-9bc388cd020d0e4fc675e02b20522f31c2464885.zip | |
Add severity to SystemNotification
Diffstat (limited to 'gui/src/main/notification-controller.ts')
| -rw-r--r-- | gui/src/main/notification-controller.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gui/src/main/notification-controller.ts b/gui/src/main/notification-controller.ts index 3ea65fa5a0..33149bcae8 100644 --- a/gui/src/main/notification-controller.ts +++ b/gui/src/main/notification-controller.ts @@ -13,6 +13,7 @@ import { ReconnectingNotificationProvider, SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from '../shared/notifications/notification'; export interface NotificationSender { @@ -111,10 +112,6 @@ export default class NotificationController { this.addPendingNotification(notification); notification.show(); - if (!systemNotification.critical) { - setTimeout(() => notification.close(), 4000); - } - return notification; } else { return; @@ -127,7 +124,8 @@ export default class NotificationController { body: systemNotification.message, silent: true, icon: this.notificationIcon, - timeoutType: systemNotification.critical ? 'never' : 'default', + timeoutType: + systemNotification.severity == SystemNotificationSeverityType.high ? 'never' : 'default', }); // Action buttons are only available on macOS. @@ -137,7 +135,12 @@ export default class NotificationController { notification.on('action', () => this.performAction(systemNotification.action)); } notification.on('click', () => this.notificationControllerDelegate.openApp()); - } else if (!(process.platform === 'win32' && systemNotification.critical)) { + } else if ( + !( + process.platform === 'win32' && + systemNotification.severity === SystemNotificationSeverityType.high + ) + ) { if (systemNotification.action) { notification.on('click', () => this.performAction(systemNotification.action)); } else { @@ -208,7 +211,8 @@ export default class NotificationController { const suppressDueToDevelopment = notification.suppressInDevelopment && process.env.NODE_ENV === 'development'; const suppressDueToVisibleWindow = isWindowVisible; - const suppressDueToPreference = !areSystemNotificationsEnabled && !notification.critical; + const suppressDueToPreference = + !areSystemNotificationsEnabled && notification.severity > SystemNotificationSeverityType.info; return ( !suppressDueToDevelopment && |
