summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-05-25 12:59:26 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-05-25 12:59:26 +0200
commit119510c7356ab4c6858a01d330d3b1452026c3ab (patch)
tree3fbf3d7ca7da56f3be4431a1117b1da0dc7d6b3f /gui/src/main
parent4374667d5b8b76a90dc2a2a5c466102bb9c84add (diff)
parent80a9394c56888af208933566c76f9fb99fe7218e (diff)
downloadmullvadvpn-119510c7356ab4c6858a01d330d3b1452026c3ab.tar.xz
mullvadvpn-119510c7356ab4c6858a01d330d3b1452026c3ab.zip
Merge branch 'improve-beta-program-gui'
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/index.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 91eaf52b57..b2d33a700e 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -65,10 +65,12 @@ export interface ICurrentAppVersionInfo {
gui: string;
daemon: string;
isConsistent: boolean;
+ currentIsBeta: boolean;
}
export interface IAppUpgradeInfo extends IAppVersionInfo {
- nextUpgrade?: string;
+ // Null is used since undefined properties get filtered out when sending through IPC.
+ nextUpgrade: string | null;
}
type AccountVerification = { status: 'verified' } | { status: 'deferred'; error: Error };
@@ -136,6 +138,7 @@ class ApplicationMain {
daemon: '',
gui: '',
isConsistent: true,
+ currentIsBeta: false,
};
private upgradeVersion: IAppUpgradeInfo = {
@@ -143,7 +146,7 @@ class ApplicationMain {
latestStable: '',
latestBeta: '',
latest: '',
- nextUpgrade: undefined,
+ nextUpgrade: null,
};
// The UI locale which is set once from onReady handler
@@ -626,6 +629,10 @@ class ApplicationMain {
consumePromise(this.fetchWireguardKey());
}
+ if (oldSettings.showBetaReleases !== newSettings.showBetaReleases) {
+ this.setLatestVersion(this.upgradeVersion);
+ }
+
if (this.windowController) {
IpcMainEventChannel.settings.notify(this.windowController.webContents, newSettings);
}
@@ -735,6 +742,7 @@ class ApplicationMain {
daemon: daemonVersion,
gui: guiVersion,
isConsistent: daemonVersion === guiVersion,
+ currentIsBeta: guiVersion.includes('beta'),
};
this.currentVersion = versionInfo;
@@ -748,15 +756,11 @@ class ApplicationMain {
private setLatestVersion(latestVersionInfo: IAppVersionInfo) {
const settings = this.settings;
- function nextUpgrade(
- current: string,
- latest: string,
- latestStable: string,
- ): string | undefined {
+ function nextUpgrade(current: string, latest: string, latestStable: string): string | null {
if (settings.showBetaReleases) {
- return current === latest ? undefined : latest;
+ return current === latest ? null : latest;
} else {
- return current === latestStable ? undefined : latestStable;
+ return current === latestStable ? null : latestStable;
}
}