summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-02-21 18:46:12 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-02-21 18:46:12 +0100
commit26a81c00ba35e12af86d48985de0cfc98032a3fe (patch)
tree6a742e4f548772b107f5b9ce71b2847244cbbca6 /gui/src/shared
parent68b96d792092acf0e5127684201a85d7628c0632 (diff)
parent16d8551c7119aa14364e90253b051b7a26ed7653 (diff)
downloadmullvadvpn-26a81c00ba35e12af86d48985de0cfc98032a3fe.tar.xz
mullvadvpn-26a81c00ba35e12af86d48985de0cfc98032a3fe.zip
Merge branch 'improve-in-app-notifications'
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/localization-contexts.ts3
-rw-r--r--gui/src/shared/notifications/error.ts74
-rw-r--r--gui/src/shared/notifications/notification.ts14
3 files changed, 86 insertions, 5 deletions
diff --git a/gui/src/shared/localization-contexts.ts b/gui/src/shared/localization-contexts.ts
index 8e8c3930be..d342a4210e 100644
--- a/gui/src/shared/localization-contexts.ts
+++ b/gui/src/shared/localization-contexts.ts
@@ -33,4 +33,5 @@ export type LocalizationContexts =
| 'support-view'
| 'select-language-nav'
| 'tray-icon-context-menu'
- | 'tray-icon-tooltip';
+ | 'tray-icon-tooltip'
+ | 'troubleshoot';
diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts
index 67267a494e..9ca0921bf6 100644
--- a/gui/src/shared/notifications/error.ts
+++ b/gui/src/shared/notifications/error.ts
@@ -11,6 +11,7 @@ import {
import { messages } from '../gettext';
import {
InAppNotification,
+ InAppNotificationAction,
InAppNotificationProvider,
SystemNotification,
SystemNotificationCategory,
@@ -77,6 +78,7 @@ export class ErrorNotificationProvider
? messages.pgettext('in-app-notifications', 'NETWORK TRAFFIC MIGHT BE LEAKING')
: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'),
subtitle,
+ action: getActions(this.context.tunnelState.details) ?? undefined,
};
} else {
return undefined;
@@ -91,7 +93,7 @@ function getMessage(errorState: ErrorState): string {
case 'win32':
return messages.pgettext(
'notifications',
- 'Unable to block all network traffic. Try disabling any third-party antivirus or security software or send a problem report.',
+ 'Unable to block all network traffic. Try temporarily disabling any third-party antivirus or security software or send a problem report.',
);
case 'linux':
return messages.pgettext(
@@ -141,7 +143,7 @@ function getMessage(errorState: ErrorState): string {
case 'win32':
return messages.pgettext(
'notifications',
- 'Unable to apply firewall rules. Try disabling any third-party antivirus or security software.',
+ 'Unable to apply firewall rules. Try temporarily disabling any third-party antivirus or security software.',
);
case 'linux':
return messages.pgettext(
@@ -184,7 +186,7 @@ function getTunnelParameterMessage(error: TunnelParameterError): string {
case TunnelParameterError.noMatchingRelay:
return messages.pgettext(
'notifications',
- 'No servers in your selected location match your settings.',
+ 'No servers match your settings, try changing server or other settings.',
);
case TunnelParameterError.noWireguardKey:
return sprintf(
@@ -203,3 +205,69 @@ function getTunnelParameterMessage(error: TunnelParameterError): string {
);
}
}
+
+function getActions(errorState: ErrorState): InAppNotificationAction | void {
+ const platform = process.platform ?? window.env.platform;
+
+ if (errorState.cause === ErrorStateCause.setFirewallPolicyError && platform === 'linux') {
+ return {
+ type: 'troubleshoot-dialog',
+ troubleshoot: {
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'This can happen because the kernel is old, or if you have removed a kernel.',
+ ),
+ steps: [
+ messages.pgettext('troubleshoot', 'Update your kernel.'),
+ messages.pgettext('troubleshoot', 'Make sure you have NF tables support.'),
+ ],
+ },
+ };
+ } else if (errorState.cause === ErrorStateCause.setDnsError) {
+ const troubleshootSteps = [];
+ if (platform === 'darwin') {
+ troubleshootSteps.push(
+ messages.pgettext(
+ 'troubleshoot',
+ 'Try to turn Wi-Fi Calling off in the FaceTime app settings and restart the Mac.',
+ ),
+ messages.pgettext(
+ 'troubleshoot',
+ 'Uninstall or disable other DNS, networking and ads/website blocking apps.',
+ ),
+ );
+ } else if (platform === 'win32') {
+ troubleshootSteps.push(
+ messages.pgettext(
+ 'troubleshoot',
+ 'Uninstall or disable other DNS, networking and ads/website blocking apps.',
+ ),
+ );
+ }
+
+ return {
+ type: 'troubleshoot-dialog',
+ troubleshoot: {
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'This error can happen when something other than Mullvad is actively updating the DNS.',
+ ),
+ steps: troubleshootSteps,
+ },
+ };
+ } else if (errorState.cause === ErrorStateCause.splitTunnelError) {
+ return {
+ type: 'troubleshoot-dialog',
+ troubleshoot: {
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'Unable to communicate with Mullvad kernel driver.',
+ ),
+ steps: [
+ messages.pgettext('troubleshoot', 'Try reconnecting.'),
+ messages.pgettext('troubleshoot', 'Try restarting your device.'),
+ ],
+ },
+ };
+ }
+}
diff --git a/gui/src/shared/notifications/notification.ts b/gui/src/shared/notifications/notification.ts
index 10b5b21fc8..88bddfa9f5 100644
--- a/gui/src/shared/notifications/notification.ts
+++ b/gui/src/shared/notifications/notification.ts
@@ -5,6 +5,18 @@ export type NotificationAction = {
withAuth?: boolean;
};
+export interface InAppNotificationTroubleshootInfo {
+ details: string;
+ steps: string[];
+}
+
+export type InAppNotificationAction =
+ | NotificationAction
+ | {
+ type: 'troubleshoot-dialog';
+ troubleshoot: InAppNotificationTroubleshootInfo;
+ };
+
export type InAppNotificationIndicatorType = 'success' | 'warning' | 'error';
export enum SystemNotificationSeverityType {
@@ -39,7 +51,7 @@ export interface InAppNotification {
indicator?: InAppNotificationIndicatorType;
title: string;
subtitle?: string;
- action?: NotificationAction;
+ action?: InAppNotificationAction;
}
export interface SystemNotificationProvider extends NotificationProvider {