diff options
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/notifications/account-expired.ts | 8 | ||||
| -rw-r--r-- | gui/src/shared/notifications/block-when-disconnected.ts | 20 | ||||
| -rw-r--r-- | gui/src/shared/notifications/close-to-account-expiry.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/connected.ts | 10 | ||||
| -rw-r--r-- | gui/src/shared/notifications/connecting.ts | 6 | ||||
| -rw-r--r-- | gui/src/shared/notifications/disconnected.ts | 10 | ||||
| -rw-r--r-- | gui/src/shared/notifications/error.ts | 9 | ||||
| -rw-r--r-- | gui/src/shared/notifications/inconsistent-version.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/notification.ts | 9 | ||||
| -rw-r--r-- | gui/src/shared/notifications/reconnecting.ts | 6 | ||||
| -rw-r--r-- | gui/src/shared/notifications/unsupported-version.ts | 3 | ||||
| -rw-r--r-- | gui/src/shared/notifications/update-available.ts | 3 |
12 files changed, 69 insertions, 21 deletions
diff --git a/gui/src/shared/notifications/account-expired.ts b/gui/src/shared/notifications/account-expired.ts index cbfc782eeb..42e40aa491 100644 --- a/gui/src/shared/notifications/account-expired.ts +++ b/gui/src/shared/notifications/account-expired.ts @@ -2,7 +2,11 @@ import { links } from '../../config.json'; import { hasExpired } from '../account-expiry'; import { TunnelState } from '../daemon-rpc-types'; import { messages } from '../gettext'; -import { SystemNotification, SystemNotificationProvider } from './notification'; +import { + SystemNotification, + SystemNotificationProvider, + SystemNotificationSeverityType, +} from './notification'; interface AccountExpiredNotificaitonContext { accountExpiry: string; @@ -23,7 +27,7 @@ export class AccountExpiredNotificationProvider implements SystemNotificationPro public getSystemNotification(): SystemNotification { return { message: messages.pgettext('notifications', 'Account is out of time'), - critical: true, + severity: SystemNotificationSeverityType.high, presentOnce: { value: true, name: this.constructor.name }, action: { type: 'open-url', diff --git a/gui/src/shared/notifications/block-when-disconnected.ts b/gui/src/shared/notifications/block-when-disconnected.ts index 91b464a299..0eada4036c 100644 --- a/gui/src/shared/notifications/block-when-disconnected.ts +++ b/gui/src/shared/notifications/block-when-disconnected.ts @@ -3,7 +3,13 @@ import { sprintf } from 'sprintf-js'; import { strings } from '../../config.json'; import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; -import { InAppNotification, InAppNotificationProvider } from './notification'; +import { + InAppNotification, + InAppNotificationProvider, + SystemNotification, + SystemNotificationProvider, + SystemNotificationSeverityType, +} from './notification'; interface BlockWhenDisconnectedNotificationContext { tunnelState: TunnelState; @@ -11,7 +17,8 @@ interface BlockWhenDisconnectedNotificationContext { hasExcludedApps: boolean; } -export class BlockWhenDisconnectedNotificationProvider implements InAppNotificationProvider { +export class BlockWhenDisconnectedNotificationProvider + implements InAppNotificationProvider, SystemNotificationProvider { public constructor(private context: BlockWhenDisconnectedNotificationContext) {} public mayDisplay() { @@ -22,6 +29,15 @@ export class BlockWhenDisconnectedNotificationProvider implements InAppNotificat ); } + public getSystemNotification(): SystemNotification { + const message = messages.pgettext('notifications', 'Lockdown mode active, connection blocked'); + + return { + message, + severity: SystemNotificationSeverityType.info, + }; + } + public getInAppNotification(): InAppNotification { const lockdownModeSettingName = messages.pgettext('vpn-settings-view', 'Lockdown mode'); let subtitle = sprintf( diff --git a/gui/src/shared/notifications/close-to-account-expiry.ts b/gui/src/shared/notifications/close-to-account-expiry.ts index 82daf05562..2a9fc1a384 100644 --- a/gui/src/shared/notifications/close-to-account-expiry.ts +++ b/gui/src/shared/notifications/close-to-account-expiry.ts @@ -9,6 +9,7 @@ import { InAppNotificationProvider, SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface CloseToAccountExpiryNotificationContext { @@ -38,7 +39,7 @@ export class CloseToAccountExpiryNotificationProvider return { message, - critical: true, + severity: SystemNotificationSeverityType.medium, action: { type: 'open-url', url: links.purchase, diff --git a/gui/src/shared/notifications/connected.ts b/gui/src/shared/notifications/connected.ts index 5fc667b78c..bcce249a15 100644 --- a/gui/src/shared/notifications/connected.ts +++ b/gui/src/shared/notifications/connected.ts @@ -2,14 +2,18 @@ import { sprintf } from 'sprintf-js'; import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; -import { SystemNotificationProvider } from './notification'; +import { + SystemNotification, + SystemNotificationProvider, + SystemNotificationSeverityType, +} from './notification'; export class ConnectedNotificationProvider implements SystemNotificationProvider { public constructor(private context: TunnelState) {} public mayDisplay = () => this.context.state === 'connected'; - public getSystemNotification() { + public getSystemNotification(): SystemNotification | undefined { if (this.context.state === 'connected') { let message = messages.pgettext('notifications', 'Connected'); const location = this.context.details.location?.hostname; @@ -27,7 +31,7 @@ export class ConnectedNotificationProvider implements SystemNotificationProvider return { message, - critical: false, + severity: SystemNotificationSeverityType.low, }; } else { return undefined; diff --git a/gui/src/shared/notifications/connecting.ts b/gui/src/shared/notifications/connecting.ts index b35d9ed3b6..bf8d3b1248 100644 --- a/gui/src/shared/notifications/connecting.ts +++ b/gui/src/shared/notifications/connecting.ts @@ -5,7 +5,9 @@ import { TunnelState } from '../daemon-rpc-types'; import { InAppNotification, InAppNotificationProvider, + SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface ConnectingNotificationContext { @@ -21,7 +23,7 @@ export class ConnectingNotificationProvider return this.context.tunnelState.state === 'connecting' && !this.context.reconnecting; } - public getSystemNotification() { + public getSystemNotification(): SystemNotification | undefined { if (this.context.tunnelState.state === 'connecting') { let message = messages.pgettext('notifications', 'Connecting'); const location = this.context.tunnelState.details?.location?.hostname; @@ -39,7 +41,7 @@ export class ConnectingNotificationProvider return { message, - critical: false, + severity: SystemNotificationSeverityType.low, }; } else { return undefined; diff --git a/gui/src/shared/notifications/disconnected.ts b/gui/src/shared/notifications/disconnected.ts index 05c53148ec..66a1e9d66e 100644 --- a/gui/src/shared/notifications/disconnected.ts +++ b/gui/src/shared/notifications/disconnected.ts @@ -1,6 +1,10 @@ import { messages } from '../../shared/gettext'; import { TunnelState } from '../daemon-rpc-types'; -import { SystemNotificationProvider } from './notification'; +import { + SystemNotification, + SystemNotificationProvider, + SystemNotificationSeverityType, +} from './notification'; interface DisconnectedNotificationContext { tunnelState: TunnelState; @@ -13,10 +17,10 @@ export class DisconnectedNotificationProvider implements SystemNotificationProvi public mayDisplay = () => this.context.tunnelState.state === 'disconnected' && !this.context.blockWhenDisconnected; - public getSystemNotification() { + public getSystemNotification(): SystemNotification | undefined { return { message: messages.pgettext('notifications', 'Disconnected and unsecure'), - critical: false, + severity: SystemNotificationSeverityType.info, }; } } diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts index fa1848a0fb..f066bc1040 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -12,7 +12,9 @@ import { messages } from '../gettext'; import { InAppNotification, InAppNotificationProvider, + SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface ErrorNotificationContext { @@ -26,7 +28,7 @@ export class ErrorNotificationProvider public mayDisplay = () => this.context.tunnelState.state === 'error'; - public getSystemNotification() { + public getSystemNotification(): SystemNotification | undefined { if (this.context.tunnelState.state === 'error') { let message = getMessage(this.context.tunnelState.details); if (!this.context.tunnelState.details.blockingError && this.context.hasExcludedApps) { @@ -41,7 +43,10 @@ export class ErrorNotificationProvider return { message, - critical: !!this.context.tunnelState.details.blockingError, + severity: + this.context.tunnelState.details.blockingError === undefined + ? SystemNotificationSeverityType.low + : SystemNotificationSeverityType.high, }; } else { return undefined; diff --git a/gui/src/shared/notifications/inconsistent-version.ts b/gui/src/shared/notifications/inconsistent-version.ts index e6118c883e..3334f9e99c 100644 --- a/gui/src/shared/notifications/inconsistent-version.ts +++ b/gui/src/shared/notifications/inconsistent-version.ts @@ -4,6 +4,7 @@ import { InAppNotificationProvider, SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface InconsistentVersionNotificationContext { @@ -19,7 +20,7 @@ export class InconsistentVersionNotificationProvider public getSystemNotification(): SystemNotification { return { message: messages.pgettext('notifications', 'App is out of sync. Please quit and restart.'), - critical: true, + severity: SystemNotificationSeverityType.high, presentOnce: { value: true, name: this.constructor.name }, suppressInDevelopment: true, }; diff --git a/gui/src/shared/notifications/notification.ts b/gui/src/shared/notifications/notification.ts index 2152da0e79..af95baa558 100644 --- a/gui/src/shared/notifications/notification.ts +++ b/gui/src/shared/notifications/notification.ts @@ -7,13 +7,20 @@ export type NotificationAction = { export type InAppNotificationIndicatorType = 'success' | 'warning' | 'error'; +export enum SystemNotificationSeverityType { + info = 0, + low, + medium, + high, +} + interface NotificationProvider { mayDisplay(): boolean; } export interface SystemNotification { message: string; - critical: boolean; + severity: SystemNotificationSeverityType; 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 9c20cad8c9..caea454eff 100644 --- a/gui/src/shared/notifications/reconnecting.ts +++ b/gui/src/shared/notifications/reconnecting.ts @@ -3,7 +3,9 @@ import { TunnelState } from '../daemon-rpc-types'; import { InAppNotification, InAppNotificationProvider, + SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; export class ReconnectingNotificationProvider @@ -14,10 +16,10 @@ export class ReconnectingNotificationProvider return this.context.state === 'disconnecting' && this.context.details === 'reconnect'; } - public getSystemNotification() { + public getSystemNotification(): SystemNotification | undefined { return { message: messages.pgettext('notifications', 'Reconnecting'), - critical: false, + severity: SystemNotificationSeverityType.info, }; } diff --git a/gui/src/shared/notifications/unsupported-version.ts b/gui/src/shared/notifications/unsupported-version.ts index 3db1db9fc7..3a012e1aad 100644 --- a/gui/src/shared/notifications/unsupported-version.ts +++ b/gui/src/shared/notifications/unsupported-version.ts @@ -5,6 +5,7 @@ import { InAppNotificationProvider, SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface UnsupportedVersionNotificationContext { @@ -25,7 +26,7 @@ export class UnsupportedVersionNotificationProvider public getSystemNotification(): SystemNotification { return { message: this.getMessage(), - critical: true, + severity: SystemNotificationSeverityType.high, action: { type: 'open-url', url: this.context.suggestedIsBeta ? links.betaDownload : links.download, diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts index 61a2452138..2205274cc6 100644 --- a/gui/src/shared/notifications/update-available.ts +++ b/gui/src/shared/notifications/update-available.ts @@ -7,6 +7,7 @@ import { InAppNotificationProvider, SystemNotification, SystemNotificationProvider, + SystemNotificationSeverityType, } from './notification'; interface UpdateAvailableNotificationContext { @@ -39,7 +40,7 @@ export class UpdateAvailableNotificationProvider public getSystemNotification(): SystemNotification { return { message: this.systemMessage(), - critical: false, + severity: SystemNotificationSeverityType.medium, action: { type: 'open-url', url: this.context.suggestedIsBeta ? links.betaDownload : links.download, |
