summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared/notifications
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-02-20 10:38:21 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-02-21 18:45:59 +0100
commit4ecd849bd1004d9b7a8bb5cf57ce2d0e7b58855e (patch)
tree0751eb3f7c44993df59df8ea946071b8b4ac7543 /gui/src/shared/notifications
parent60d51ec8cd14a965ffbcc4e0112c3351f1fc1cef (diff)
downloadmullvadvpn-4ecd849bd1004d9b7a8bb5cf57ce2d0e7b58855e.tar.xz
mullvadvpn-4ecd849bd1004d9b7a8bb5cf57ce2d0e7b58855e.zip
Add in app notification dialog specification
Diffstat (limited to 'gui/src/shared/notifications')
-rw-r--r--gui/src/shared/notifications/error.ts62
-rw-r--r--gui/src/shared/notifications/notification.ts10
2 files changed, 71 insertions, 1 deletions
diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts
index 7134f0ec36..4970fccbaa 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;
@@ -203,3 +205,63 @@ 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: 'info-dialog',
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'This can happen because the kernel is old, or if you have removed a kernel.',
+ ),
+ troubleshoot: [
+ 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: 'info-dialog',
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'This error can happen when something other than Mullvad is actively updating the DNS.',
+ ),
+ troubleshoot: troubleshootSteps,
+ };
+ } else if (errorState.cause === ErrorStateCause.splitTunnelError) {
+ return {
+ type: 'info-dialog',
+ details: messages.pgettext(
+ 'troubleshoot',
+ 'Unable to communicate with Mullvad kernel driver.',
+ ),
+ troubleshoot: [
+ 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..5264dd7305 100644
--- a/gui/src/shared/notifications/notification.ts
+++ b/gui/src/shared/notifications/notification.ts
@@ -5,6 +5,14 @@ export type NotificationAction = {
withAuth?: boolean;
};
+export type InAppNotificationAction =
+ | NotificationAction
+ | {
+ type: 'info-dialog';
+ details: string;
+ troubleshoot: string[];
+ };
+
export type InAppNotificationIndicatorType = 'success' | 'warning' | 'error';
export enum SystemNotificationSeverityType {
@@ -39,7 +47,7 @@ export interface InAppNotification {
indicator?: InAppNotificationIndicatorType;
title: string;
subtitle?: string;
- action?: NotificationAction;
+ action?: InAppNotificationAction;
}
export interface SystemNotificationProvider extends NotificationProvider {