diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-11-30 15:00:30 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-09 10:39:26 +0100 |
| commit | b00d0b5a176c4d8dcd403a60395c5a1087c42cdd (patch) | |
| tree | 188a7c4eeb204a1e81cb9504a8c59b10a85355ea /gui/src/shared | |
| parent | 9bc388cd020d0e4fc675e02b20522f31c2464885 (diff) | |
| download | mullvadvpn-b00d0b5a176c4d8dcd403a60395c5a1087c42cdd.tar.xz mullvadvpn-b00d0b5a176c4d8dcd403a60395c5a1087c42cdd.zip | |
Add notification categories
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/notifications/block-when-disconnected.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/connected.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/connecting.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/disconnected.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/error.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/notification.ts | 6 | ||||
| -rw-r--r-- | gui/src/shared/notifications/reconnecting.ts | 3 |
7 files changed, 24 insertions, 0 deletions
diff --git a/gui/src/shared/notifications/block-when-disconnected.ts b/gui/src/shared/notifications/block-when-disconnected.ts index 0eada4036c..3d7ec1e509 100644 --- a/gui/src/shared/notifications/block-when-disconnected.ts +++ b/gui/src/shared/notifications/block-when-disconnected.ts @@ -7,6 +7,7 @@ import { InAppNotification, InAppNotificationProvider, SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -35,6 +36,8 @@ export class BlockWhenDisconnectedNotificationProvider return { message, severity: SystemNotificationSeverityType.info, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: true, }; } diff --git a/gui/src/shared/notifications/connected.ts b/gui/src/shared/notifications/connected.ts index bcce249a15..d695df1c95 100644 --- a/gui/src/shared/notifications/connected.ts +++ b/gui/src/shared/notifications/connected.ts @@ -4,6 +4,7 @@ import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; import { SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -32,6 +33,8 @@ export class ConnectedNotificationProvider implements SystemNotificationProvider return { message, severity: SystemNotificationSeverityType.low, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: true, }; } else { return undefined; diff --git a/gui/src/shared/notifications/connecting.ts b/gui/src/shared/notifications/connecting.ts index bf8d3b1248..e722e7fb95 100644 --- a/gui/src/shared/notifications/connecting.ts +++ b/gui/src/shared/notifications/connecting.ts @@ -6,6 +6,7 @@ import { InAppNotification, InAppNotificationProvider, SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -42,6 +43,8 @@ export class ConnectingNotificationProvider return { message, severity: SystemNotificationSeverityType.low, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: true, }; } else { return undefined; diff --git a/gui/src/shared/notifications/disconnected.ts b/gui/src/shared/notifications/disconnected.ts index 66a1e9d66e..531c95d015 100644 --- a/gui/src/shared/notifications/disconnected.ts +++ b/gui/src/shared/notifications/disconnected.ts @@ -2,6 +2,7 @@ import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; import { SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -21,6 +22,8 @@ export class DisconnectedNotificationProvider implements SystemNotificationProvi return { message: messages.pgettext('notifications', 'Disconnected and unsecure'), severity: SystemNotificationSeverityType.info, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: true, }; } } diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts index f066bc1040..e878f5ef19 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -13,6 +13,7 @@ import { InAppNotification, InAppNotificationProvider, SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -47,6 +48,8 @@ export class ErrorNotificationProvider this.context.tunnelState.details.blockingError === undefined ? SystemNotificationSeverityType.low : SystemNotificationSeverityType.high, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: false, }; } else { return undefined; diff --git a/gui/src/shared/notifications/notification.ts b/gui/src/shared/notifications/notification.ts index af95baa558..873f7b2f4a 100644 --- a/gui/src/shared/notifications/notification.ts +++ b/gui/src/shared/notifications/notification.ts @@ -14,6 +14,10 @@ export enum SystemNotificationSeverityType { high, } +export enum SystemNotificationCategory { + tunnelState, +} + interface NotificationProvider { mayDisplay(): boolean; } @@ -21,6 +25,8 @@ interface NotificationProvider { export interface SystemNotification { message: string; severity: SystemNotificationSeverityType; + category?: SystemNotificationCategory; + replaceByCategory?: boolean; presentOnce?: { value: boolean; name: string }; suppressInDevelopment?: boolean; action?: NotificationAction; diff --git a/gui/src/shared/notifications/reconnecting.ts b/gui/src/shared/notifications/reconnecting.ts index caea454eff..08eb36b18d 100644 --- a/gui/src/shared/notifications/reconnecting.ts +++ b/gui/src/shared/notifications/reconnecting.ts @@ -4,6 +4,7 @@ import { InAppNotification, InAppNotificationProvider, SystemNotification, + SystemNotificationCategory, SystemNotificationProvider, SystemNotificationSeverityType, } from './notification'; @@ -20,6 +21,8 @@ export class ReconnectingNotificationProvider return { message: messages.pgettext('notifications', 'Reconnecting'), severity: SystemNotificationSeverityType.info, + category: SystemNotificationCategory.tunnelState, + replaceByCategory: true, }; } |
