diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-04-19 13:46:14 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-02 16:15:01 +0200 |
| commit | daf15f2916f99774429724aca4713734a85fee62 (patch) | |
| tree | a8beff4d0e03a6245050255097747c46a6ee5f85 /gui/src/shared | |
| parent | de95e3465268f0489b00bb1ee2c1a04fc54bb3e5 (diff) | |
| download | mullvadvpn-daf15f2916f99774429724aca4713734a85fee62.tar.xz mullvadvpn-daf15f2916f99774429724aca4713734a85fee62.zip | |
Add warning about DNS not working for excluded apps when blocked
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/notifications/block-when-disconnected.ts | 11 | ||||
| -rw-r--r-- | gui/src/shared/notifications/error.ts | 53 |
2 files changed, 47 insertions, 17 deletions
diff --git a/gui/src/shared/notifications/block-when-disconnected.ts b/gui/src/shared/notifications/block-when-disconnected.ts index fb19655993..6dcc3cc749 100644 --- a/gui/src/shared/notifications/block-when-disconnected.ts +++ b/gui/src/shared/notifications/block-when-disconnected.ts @@ -5,6 +5,7 @@ import { InAppNotification, InAppNotificationProvider } from './notification'; interface BlockWhenDisconnectedNotificationContext { tunnelState: TunnelState; blockWhenDisconnected: boolean; + hasExcludedApps: boolean; } export class BlockWhenDisconnectedNotificationProvider implements InAppNotificationProvider { @@ -19,10 +20,18 @@ export class BlockWhenDisconnectedNotificationProvider implements InAppNotificat } public getInAppNotification(): InAppNotification { + let subtitle = messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.'); + if (this.context.hasExcludedApps) { + subtitle = `${subtitle} ${messages.pgettext( + 'notifications', + 'The apps excluded with split tunneling might not work properly right now.', + )}`; + } + return { indicator: 'warning', title: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'), - subtitle: messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.'), + subtitle, }; } } diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts index c5f15482dc..4ed97da301 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -11,6 +11,7 @@ import { interface ErrorNotificationContext { tunnelState: TunnelState; accountExpiry?: string; + hasExcludedApps: boolean; } export class ErrorNotificationProvider @@ -20,25 +21,45 @@ export class ErrorNotificationProvider public mayDisplay = () => this.context.tunnelState.state === 'error'; public getSystemNotification() { - return this.context.tunnelState.state === 'error' - ? { - message: getMessage(this.context.tunnelState.details, this.context.accountExpiry), - critical: !!this.context.tunnelState.details.blockFailure, - } - : undefined; + if (this.context.tunnelState.state === 'error') { + let message = getMessage(this.context.tunnelState.details, this.context.accountExpiry); + if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) { + message = `${message} ${messages.pgettext( + 'notifications', + 'The apps excluded with split tunneling might not work properly right now.', + )}`; + } + + return { + message, + critical: !!this.context.tunnelState.details.blockFailure, + }; + } else { + return undefined; + } } public getInAppNotification(): InAppNotification | undefined { - return this.context.tunnelState.state === 'error' - ? { - indicator: - this.context.tunnelState.details.cause.reason === 'is_offline' ? 'warning' : 'error', - title: !this.context.tunnelState.details.blockFailure - ? messages.pgettext('in-app-notifications', 'BLOCKING INTERNET') - : messages.pgettext('in-app-notifications', 'NETWORK TRAFFIC MIGHT BE LEAKING'), - subtitle: getMessage(this.context.tunnelState.details, this.context.accountExpiry), - } - : undefined; + if (this.context.tunnelState.state === 'error') { + let subtitle = getMessage(this.context.tunnelState.details, this.context.accountExpiry); + if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) { + subtitle = `${subtitle} ${messages.pgettext( + 'notifications', + 'The apps excluded with split tunneling might not work properly right now.', + )}`; + } + + return { + indicator: + this.context.tunnelState.details.cause.reason === 'is_offline' ? 'warning' : 'error', + title: !this.context.tunnelState.details.blockFailure + ? messages.pgettext('in-app-notifications', 'BLOCKING INTERNET') + : messages.pgettext('in-app-notifications', 'NETWORK TRAFFIC MIGHT BE LEAKING'), + subtitle, + }; + } else { + return undefined; + } } } |
