diff options
| author | Oskar <oskar@mullvad.net> | 2024-08-13 17:21:05 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-08-21 17:05:50 +0200 |
| commit | e2167ef3c42006db2b0b5ba041f1199d0d3f306d (patch) | |
| tree | 81b8941c12880af51faaab0be8933a9e7b53cd49 /gui/src/shared | |
| parent | b26659e05b50c3a1b0499620f683748287707769 (diff) | |
| download | mullvadvpn-e2167ef3c42006db2b0b5ba041f1199d0d3f306d.tar.xz mullvadvpn-e2167ef3c42006db2b0b5ba041f1199d0d3f306d.zip | |
Add feature indicator plumbing
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..2871fea4d1 100644 --- a/gui/src/shared/notifications/error.ts +++ b/gui/src/shared/notifications/error.ts @@ -3,7 +3,7 @@ import { sprintf } from 'sprintf-js'; import { strings } from '../../config.json'; import { AuthFailedError, - ErrorState, + ErrorStateDetails, ErrorStateCause, TunnelParameterError, TunnelState, @@ -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') { |
