diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-11-30 10:37:14 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-11-30 10:37:14 +0100 |
| commit | 4bf5b1c5df0776d18e7a31f40c0d840e508b4b22 (patch) | |
| tree | 86b0897032d465ec70b878ee336443171455cd4f /gui/src/renderer | |
| parent | d424bdbedeb1c8e44b693eac02d169e11b7ac92a (diff) | |
| parent | 4fe3a01bc392ee1392e23f424987a01733a9a57e (diff) | |
| download | mullvadvpn-4bf5b1c5df0776d18e7a31f40c0d840e508b4b22.tar.xz mullvadvpn-4bf5b1c5df0776d18e7a31f40c0d840e508b4b22.zip | |
Merge branch 'improve-tunnel-state-error-handling'
Diffstat (limited to 'gui/src/renderer')
| -rw-r--r-- | gui/src/renderer/app.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/Connect.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/HeaderBar.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/MainView.tsx | 11 | ||||
| -rw-r--r-- | gui/src/renderer/components/NotificationArea.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/components/TunnelControl.tsx | 2 | ||||
| -rw-r--r-- | gui/src/renderer/redux/connection/actions.ts | 6 |
7 files changed, 16 insertions, 11 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index ae7cdec881..e78462041b 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -754,7 +754,7 @@ export default class AppRenderer { break; case 'error': - actions.updateBlockState(!tunnelState.details.blockFailure); + actions.updateBlockState(!tunnelState.details.blockingError); break; } } diff --git a/gui/src/renderer/components/Connect.tsx b/gui/src/renderer/components/Connect.tsx index 492fcc3fc9..79de3c5242 100644 --- a/gui/src/renderer/components/Connect.tsx +++ b/gui/src/renderer/components/Connect.tsx @@ -97,7 +97,7 @@ export default function Connect() { case 'connected': return MarkerStyle.secure; case 'error': - return !connection.status.details.blockFailure ? MarkerStyle.secure : MarkerStyle.unsecure; + return !connection.status.details.blockingError ? MarkerStyle.secure : MarkerStyle.unsecure; case 'disconnected': return MarkerStyle.unsecure; case 'disconnecting': diff --git a/gui/src/renderer/components/HeaderBar.tsx b/gui/src/renderer/components/HeaderBar.tsx index 3cf96df6fc..7c436e3c16 100644 --- a/gui/src/renderer/components/HeaderBar.tsx +++ b/gui/src/renderer/components/HeaderBar.tsx @@ -139,7 +139,7 @@ export function calculateHeaderBarStyle(tunnelState: TunnelState): HeaderBarStyl case 'connected': return HeaderBarStyle.success; case 'error': - return !tunnelState.details.blockFailure ? HeaderBarStyle.success : HeaderBarStyle.error; + return !tunnelState.details.blockingError ? HeaderBarStyle.success : HeaderBarStyle.error; case 'disconnecting': switch (tunnelState.details) { case 'block': diff --git a/gui/src/renderer/components/MainView.tsx b/gui/src/renderer/components/MainView.tsx index cc2419ddfd..983a33d376 100644 --- a/gui/src/renderer/components/MainView.tsx +++ b/gui/src/renderer/components/MainView.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { hasExpired } from '../../shared/account-expiry'; +import { AuthFailedError, ErrorStateCause } from '../../shared/daemon-rpc-types'; import Connect from '../components/Connect'; import { useHistory } from '../lib/history'; import { RoutePath } from '../lib/routes'; @@ -16,6 +17,7 @@ export default function MainView() { const isNewAccount = useSelector( (state) => state.account.status.type === 'ok' && state.account.status.method === 'new_account', ); + const tunnelState = useSelector((state) => state.connection.status); const [showAccountExpired, setShowAccountExpired] = useState<ExpiryData>(() => isNewAccount || accountHasExpired ? { show: true, expiry: accountExpiry } : { show: false }, @@ -23,8 +25,11 @@ export default function MainView() { useEffect(() => { if ( - accountHasExpired && - (!showAccountExpired.show || showAccountExpired.expiry !== accountExpiry) + (!showAccountExpired.show || showAccountExpired.expiry !== accountExpiry) && + (accountHasExpired || + (tunnelState.state === 'error' && + tunnelState.details.cause === ErrorStateCause.authFailed && + tunnelState.details.authFailedError === AuthFailedError.expiredAccount)) ) { setShowAccountExpired({ show: true, expiry: accountExpiry }); } else if ( @@ -34,7 +39,7 @@ export default function MainView() { ) { history.push(RoutePath.timeAdded); } - }, [showAccountExpired, accountHasExpired]); + }, [showAccountExpired, accountHasExpired, tunnelState.state]); if (showAccountExpired.show) { return <ExpiredAccountErrorView />; diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx index acd1aaf2df..317cc1e923 100644 --- a/gui/src/renderer/components/NotificationArea.tsx +++ b/gui/src/renderer/components/NotificationArea.tsx @@ -51,7 +51,7 @@ export default function NotificationArea(props: IProps) { blockWhenDisconnected, hasExcludedApps, }), - new ErrorNotificationProvider({ tunnelState, accountExpiry, hasExcludedApps }), + new ErrorNotificationProvider({ tunnelState, hasExcludedApps }), new InconsistentVersionNotificationProvider({ consistent: version.consistent }), new UnsupportedVersionNotificationProvider(version), ]; diff --git a/gui/src/renderer/components/TunnelControl.tsx b/gui/src/renderer/components/TunnelControl.tsx index db0503cb0a..c9fd568a3f 100644 --- a/gui/src/renderer/components/TunnelControl.tsx +++ b/gui/src/renderer/components/TunnelControl.tsx @@ -139,7 +139,7 @@ export default class TunnelControl extends React.Component<ITunnelControlProps> case 'error': if ( this.props.tunnelState.state === 'error' && - this.props.tunnelState.details.blockFailure + this.props.tunnelState.details.blockingError ) { return ( <Wrapper> diff --git a/gui/src/renderer/redux/connection/actions.ts b/gui/src/renderer/redux/connection/actions.ts index 20c63d433d..35af568fb2 100644 --- a/gui/src/renderer/redux/connection/actions.ts +++ b/gui/src/renderer/redux/connection/actions.ts @@ -1,6 +1,6 @@ import { AfterDisconnect, - IErrorState, + ErrorState, ILocation, ITunnelStateRelayInfo, } from '../../../shared/daemon-rpc-types'; @@ -26,7 +26,7 @@ interface IDisconnectingAction { interface IBlockedAction { type: 'TUNNEL_ERROR'; - errorState: IErrorState; + errorState: ErrorState; } interface INewLocationAction { @@ -75,7 +75,7 @@ function disconnecting(afterDisconnect: AfterDisconnect): IDisconnectingAction { }; } -function blocked(errorState: IErrorState): IBlockedAction { +function blocked(errorState: ErrorState): IBlockedAction { return { type: 'TUNNEL_ERROR', errorState, |
