diff options
| author | Oskar <oskar@mullvad.net> | 2024-08-21 17:08:37 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-08-21 17:08:37 +0200 |
| commit | 0cc9684200426eef11b65cf8373d29eddf8aa90e (patch) | |
| tree | 68dc1c457f693035ea26b723414b7cd2a28958e3 /gui/src/shared | |
| parent | b26659e05b50c3a1b0499620f683748287707769 (diff) | |
| parent | 6ceed1dffca2fc0c4b867fe60638db5bf29f1065 (diff) | |
| download | mullvadvpn-0cc9684200426eef11b65cf8373d29eddf8aa90e.tar.xz mullvadvpn-0cc9684200426eef11b65cf8373d29eddf8aa90e.zip | |
Merge branch 'implement-feature-indicators-in-main-view-des-910'
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 48 | ||||
| -rw-r--r-- | gui/src/shared/notifications/error.ts | 6 |
2 files changed, 45 insertions, 9 deletions
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 295db8f323..ed588ff811 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -65,7 +65,7 @@ export enum TunnelParameterError { customTunnelHostResolutionError, } -export type ErrorState = +export type ErrorStateDetails = | { cause: | ErrorStateCause.ipv6Unavailable @@ -180,12 +180,48 @@ export interface ITunnelStateRelayInfo { location?: ILocation; } +// The order of the variants match the priority order and can be sorted on. +export enum FeatureIndicator { + daita, + quantumResistance, + multihop, + bridgeMode, + splitTunneling, + lockdownMode, + udp2tcp, + shadowsocks, + lanSharing, + dnsContentBlockers, + customDns, + serverIpOverride, + customMtu, + customMssFix, +} + +export type DisconnectedState = { state: 'disconnected'; location?: Partial<ILocation> }; +export type ConnectingState = { + state: 'connecting'; + details?: ITunnelStateRelayInfo; + featureIndicators?: Array<FeatureIndicator>; +}; +export type ConnectedState = { + state: 'connected'; + details: ITunnelStateRelayInfo; + featureIndicators?: Array<FeatureIndicator>; +}; +export type DisconnectingState = { + state: 'disconnecting'; + details: AfterDisconnect; + location?: Partial<ILocation>; +}; +export type ErrorState = { state: 'error'; details: ErrorStateDetails }; + export type TunnelState = - | { state: 'disconnected'; location?: Partial<ILocation> } - | { state: 'connecting'; details?: ITunnelStateRelayInfo } - | { state: 'connected'; details: ITunnelStateRelayInfo } - | { state: 'disconnecting'; details: AfterDisconnect; location?: Partial<ILocation> } - | { state: 'error'; details: ErrorState }; + | DisconnectedState + | ConnectingState + | ConnectedState + | DisconnectingState + | ErrorState; export interface RelayLocationCountry extends Partial<RelayLocationCustomList> { country: string; diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts index dae080bb29..af82748d7b 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -3,8 +3,8 @@ import { sprintf } from 'sprintf-js'; import { strings } from '../../config.json'; import { AuthFailedError, - ErrorState, ErrorStateCause, + ErrorStateDetails, TunnelParameterError, TunnelState, } from '../daemon-rpc-types'; @@ -87,7 +87,7 @@ export class ErrorNotificationProvider } } - private getMessage(errorState: ErrorState): string { + private getMessage(errorState: ErrorStateDetails): string { if (errorState.blockingError) { if (errorState.cause === ErrorStateCause.setFirewallPolicyError) { switch (process.platform ?? window.env.platform) { @@ -229,7 +229,7 @@ export class ErrorNotificationProvider } } - private getActions(errorState: ErrorState): InAppNotificationAction | void { + private getActions(errorState: ErrorStateDetails): InAppNotificationAction | void { const platform = process.platform ?? window.env.platform; if (errorState.cause === ErrorStateCause.setFirewallPolicyError && platform === 'linux') { |
