summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-09-03 14:34:14 +0200
committerLinus Färnstrand <linus@mullvad.net>2019-09-09 12:31:33 +0200
commit9ef235edd8d7c2f8e7a2a5bbd42d8467742172eb (patch)
treed903097cdb104b659b872f77aa961aa4df0281af /gui
parent82497c9bc8cf8f40ab179330a7f9d19ec7dfa057 (diff)
downloadmullvadvpn-9ef235edd8d7c2f8e7a2a5bbd42d8467742172eb.tar.xz
mullvadvpn-9ef235edd8d7c2f8e7a2a5bbd42d8467742172eb.zip
Add current_is_outdated support to Electron frontend
Diffstat (limited to 'gui')
-rw-r--r--gui/src/main/daemon-rpc.ts1
-rw-r--r--gui/src/main/index.ts17
-rw-r--r--gui/src/renderer/components/NotificationArea.tsx2
-rw-r--r--gui/src/renderer/containers/SettingsPage.tsx2
-rw-r--r--gui/src/renderer/redux/version/actions.ts1
-rw-r--r--gui/src/renderer/redux/version/reducers.ts4
-rw-r--r--gui/src/shared/daemon-rpc-types.ts1
-rw-r--r--gui/test/components/NotificationArea.spec.tsx8
8 files changed, 11 insertions, 25 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 2d4141304e..25f0d32748 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -284,6 +284,7 @@ const tunnelStateSchema = oneOf(
const appVersionInfoSchema = partialObject({
current_is_supported: boolean,
+ current_is_outdated: boolean,
latest_stable: string,
latest: string,
});
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index a0694e814c..4f0454d5e2 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -64,7 +64,6 @@ export interface ICurrentAppVersionInfo {
export interface IAppUpgradeInfo extends IAppVersionInfo {
nextUpgrade?: string;
- upToDate: boolean;
}
type AccountVerification = { status: 'verified' } | { status: 'deferred'; error: Error };
@@ -134,10 +133,10 @@ class ApplicationMain {
private upgradeVersion: IAppUpgradeInfo = {
currentIsSupported: true,
+ currentIsOutdated: false,
latestStable: '',
latest: '',
nextUpgrade: undefined,
- upToDate: true,
};
private latestVersionInterval?: NodeJS.Timeout;
@@ -722,23 +721,10 @@ class ApplicationMain {
}
}
- function checkIfLatest(current: string, latest: string, latestStable: string): boolean {
- // perhaps -beta?
- if (isBeta(current)) {
- return current === latest;
- } else {
- // must be stable
- return current === latestStable;
- }
- }
-
const currentVersionInfo = this.currentVersion;
const latestVersion = latestVersionInfo.latest;
const latestStableVersion = latestVersionInfo.latestStable;
- // the reason why we rely on daemon version here is because daemon obtains the version info
- // based on its built-in version information
- const isUpToDate = checkIfLatest(currentVersionInfo.daemon, latestVersion, latestStableVersion);
const upgradeVersion = nextUpgrade(
currentVersionInfo.daemon,
latestVersion,
@@ -748,7 +734,6 @@ class ApplicationMain {
const upgradeInfo = {
...latestVersionInfo,
nextUpgrade: upgradeVersion,
- upToDate: isUpToDate,
};
this.upgradeVersion = upgradeInfo;
diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx
index 9e4c971a89..a0cc9e08e3 100644
--- a/gui/src/renderer/components/NotificationArea.tsx
+++ b/gui/src/renderer/components/NotificationArea.tsx
@@ -176,7 +176,7 @@ export default class NotificationArea extends Component<IProps, State> {
};
}
- if (!version.upToDate && version.nextUpgrade) {
+ if (version.currentIsOutdated && version.nextUpgrade) {
return {
visible: true,
type: 'update-available',
diff --git a/gui/src/renderer/containers/SettingsPage.tsx b/gui/src/renderer/containers/SettingsPage.tsx
index e8a9c8ee9a..eb036920c1 100644
--- a/gui/src/renderer/containers/SettingsPage.tsx
+++ b/gui/src/renderer/containers/SettingsPage.tsx
@@ -13,7 +13,7 @@ const mapStateToProps = (state: IReduxState, props: ISharedRouteProps) => ({
expiryLocale: props.locale,
appVersion: state.version.current,
consistentVersion: state.version.consistent,
- upToDateVersion: state.version.upToDate,
+ upToDateVersion: !state.version.currentIsOutdated,
isOffline: state.connection.isBlocked,
});
const mapDispatchToProps = (dispatch: ReduxDispatch, _props: ISharedRouteProps) => {
diff --git a/gui/src/renderer/redux/version/actions.ts b/gui/src/renderer/redux/version/actions.ts
index 1eefb7e62c..eb8a81a43d 100644
--- a/gui/src/renderer/redux/version/actions.ts
+++ b/gui/src/renderer/redux/version/actions.ts
@@ -1,7 +1,6 @@
import { IAppVersionInfo } from '../../../shared/daemon-rpc-types';
interface IUpdateLatestActionPayload extends IAppVersionInfo {
- upToDate: boolean;
nextUpgrade?: string;
}
diff --git a/gui/src/renderer/redux/version/reducers.ts b/gui/src/renderer/redux/version/reducers.ts
index 034e3aab59..e853bc569a 100644
--- a/gui/src/renderer/redux/version/reducers.ts
+++ b/gui/src/renderer/redux/version/reducers.ts
@@ -3,20 +3,20 @@ import { ReduxAction } from '../store';
export interface IVersionReduxState {
current: string;
currentIsSupported: boolean;
+ currentIsOutdated: boolean;
latest?: string;
latestStable?: string;
nextUpgrade?: string;
- upToDate: boolean;
consistent: boolean;
}
const initialState: IVersionReduxState = {
current: '',
currentIsSupported: true,
+ currentIsOutdated: false,
latest: undefined,
latestStable: undefined,
nextUpgrade: undefined,
- upToDate: true,
consistent: true,
};
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts
index 0f73586275..b16355af8f 100644
--- a/gui/src/shared/daemon-rpc-types.ts
+++ b/gui/src/shared/daemon-rpc-types.ts
@@ -280,6 +280,7 @@ export interface IShadowsocksProxySettings {
export interface IAppVersionInfo {
currentIsSupported: boolean;
+ currentIsOutdated: boolean;
latestStable: string;
latest: string;
}
diff --git a/gui/test/components/NotificationArea.spec.tsx b/gui/test/components/NotificationArea.spec.tsx
index a92eced532..6b86639a75 100644
--- a/gui/test/components/NotificationArea.spec.tsx
+++ b/gui/test/components/NotificationArea.spec.tsx
@@ -10,7 +10,7 @@ describe('components/NotificationArea', () => {
const defaultVersion = {
consistent: true,
currentIsSupported: true,
- upToDate: true,
+ currentIsOutdated: false,
current: '2018.2',
latest: '2018.2-beta1',
latestStable: '2018.2',
@@ -185,7 +185,7 @@ describe('components/NotificationArea', () => {
version={{
...defaultVersion,
currentIsSupported: false,
- upToDate: false,
+ currentIsOutdated: true,
current: '2018.1',
nextUpgrade: '2018.2',
}}
@@ -207,7 +207,7 @@ describe('components/NotificationArea', () => {
}}
version={{
...defaultVersion,
- upToDate: false,
+ currentIsOutdated: true,
current: '2018.2',
latest: '2018.4-beta2',
latestStable: '2018.3',
@@ -232,7 +232,7 @@ describe('components/NotificationArea', () => {
}}
version={{
...defaultVersion,
- upToDate: false,
+ currentIsOutdated: true,
current: '2018.4-beta1',
latest: '2018.4-beta3',
latestStable: '2018.3',