summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-06-11 23:23:05 +0100
committerEmīls <emils@mullvad.net>2020-06-25 15:21:31 +0100
commit0815cb48730fdd6c8e6435dac410aa8acd36bab4 (patch)
treecf47e4dc81c1cc2743520be70e085a29f4c4b746 /gui/src/shared
parentb7bbbb05fe4a44fdb87cd9d8842fa96956f12c3f (diff)
downloadmullvadvpn-0815cb48730fdd6c8e6435dac410aa8acd36bab4.tar.xz
mullvadvpn-0815cb48730fdd6c8e6435dac410aa8acd36bab4.zip
Update GUI to not show update info if the app is too new
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/daemon-rpc-types.ts4
-rw-r--r--gui/src/shared/ipc-event-channel.ts9
-rw-r--r--gui/src/shared/notifications/unsupported-version.ts46
-rw-r--r--gui/src/shared/notifications/update-available.ts7
4 files changed, 32 insertions, 34 deletions
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts
index 7d357a3b48..bec0275e9b 100644
--- a/gui/src/shared/daemon-rpc-types.ts
+++ b/gui/src/shared/daemon-rpc-types.ts
@@ -279,9 +279,7 @@ export interface IShadowsocksProxySettings {
export interface IAppVersionInfo {
supported: boolean;
- latest: string;
- latestStable: string;
- latestBeta: string;
+ suggestedUpgrade?: string;
}
export interface ISettings {
diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts
index c09b8d2a84..b020808e76 100644
--- a/gui/src/shared/ipc-event-channel.ts
+++ b/gui/src/shared/ipc-event-channel.ts
@@ -4,13 +4,14 @@ import * as uuid from 'uuid';
import { IGuiSettingsState } from './gui-settings-state';
-import { IAppUpgradeInfo, ICurrentAppVersionInfo } from '../main/index';
+import { ICurrentAppVersionInfo } from '../main/index';
import { IWindowShapeParameters } from '../main/window-controller';
import {
AccountToken,
BridgeSettings,
BridgeState,
IAccountData,
+ IAppVersionInfo,
ILocation,
IRelayList,
ISettings,
@@ -32,7 +33,7 @@ export interface IAppStateSnapshot {
location?: ILocation;
relayListPair: IRelayListPair;
currentVersion: ICurrentAppVersionInfo;
- upgradeVersion: IAppUpgradeInfo;
+ upgradeVersion: IAppVersionInfo;
guiSettings: IGuiSettingsState;
wireguardPublicKey?: IWireguardPublicKey;
}
@@ -267,7 +268,7 @@ export class IpcRendererEventChannel {
listen: listen(CURRENT_VERSION_CHANGED),
};
- public static upgradeVersion: IReceiver<IAppUpgradeInfo> = {
+ public static upgradeVersion: IReceiver<IAppVersionInfo> = {
listen: listen(UPGRADE_VERSION_CHANGED),
};
@@ -364,7 +365,7 @@ export class IpcMainEventChannel {
notify: sender(CURRENT_VERSION_CHANGED),
};
- public static upgradeVersion: ISender<IAppUpgradeInfo> = {
+ public static upgradeVersion: ISender<IAppVersionInfo> = {
notify: sender(UPGRADE_VERSION_CHANGED),
};
diff --git a/gui/src/shared/notifications/unsupported-version.ts b/gui/src/shared/notifications/unsupported-version.ts
index ed471bc586..fd2e0b5c72 100644
--- a/gui/src/shared/notifications/unsupported-version.ts
+++ b/gui/src/shared/notifications/unsupported-version.ts
@@ -11,7 +11,7 @@ import {
interface UnsupportedVersionNotificationContext {
supported: boolean;
consistent: boolean;
- nextUpgrade: string | null;
+ suggestedUpgrade?: string;
}
export class UnsupportedVersionNotificationProvider
@@ -19,21 +19,11 @@ export class UnsupportedVersionNotificationProvider
public constructor(private context: UnsupportedVersionNotificationContext) {}
public mayDisplay() {
- return this.context.consistent && !this.context.supported && this.context.nextUpgrade !== null;
+ return this.context.consistent && !this.context.supported;
}
public getSystemNotification(): SystemNotification {
- const message = sprintf(
- // TRANSLATORS: The system notification displayed to the user when the running app becomes unsupported.
- // TRANSLATORS: Available placeholder:
- // TRANSLATORS: %(version) - the newest available version of the app
- messages.pgettext(
- 'notifications',
- 'You are running an unsupported app version. Please upgrade to %(version)s now to ensure your security',
- ),
- { version: this.context.nextUpgrade },
- );
-
+ const message = this.getMessage();
return {
message,
critical: true,
@@ -44,16 +34,7 @@ export class UnsupportedVersionNotificationProvider
}
public getInAppNotification(): InAppNotification {
- const subtitle = sprintf(
- // TRANSLATORS: The in-app banner displayed to the user when the running app becomes unsupported.
- // TRANSLATORS: Available placeholders:
- // TRANSLATORS: %(version)s - the newest available version of the app
- messages.pgettext(
- 'in-app-notifications',
- 'You are running an unsupported app version. Please upgrade to %(version)s now to ensure your security',
- ),
- { version: this.context.nextUpgrade },
- );
+ const subtitle = this.getMessage();
return {
indicator: 'error',
@@ -62,4 +43,23 @@ export class UnsupportedVersionNotificationProvider
action: { type: 'open-url', url: links.download },
};
}
+
+ private getMessage(): string {
+ // TRANSLATORS: The in-app banner and system notification which are displayed to the user when the running app becomes unsupported.
+ let message = messages.pgettext('notifications', 'You are running an unsupported app version.');
+ if (this.context.suggestedUpgrade) {
+ message += ' ';
+ message += sprintf(
+ // TRANSLATORS: Appendix to the system notification and in-app banner about the app becoming unsupported with the suggested supported version.
+ // TRANSLATORS: Available placeholder:
+ // TRANSLATORS: %(version) - the newest available version of the app
+ messages.pgettext(
+ 'notifications',
+ 'Please upgrade to %(version)s now to ensure your security',
+ ),
+ { version: this.context.suggestedUpgrade },
+ );
+ }
+ return message;
+ }
}
diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts
index 4d449bff28..d386765087 100644
--- a/gui/src/shared/notifications/update-available.ts
+++ b/gui/src/shared/notifications/update-available.ts
@@ -4,15 +4,14 @@ import { messages } from '../../shared/gettext';
import { InAppNotification, InAppNotificationProvider } from './notification';
interface UpdateAvailableNotificationContext {
- current: string;
- nextUpgrade: string | null;
+ suggestedUpgrade?: string;
}
export class UpdateAvailableNotificationProvider implements InAppNotificationProvider {
public constructor(private context: UpdateAvailableNotificationContext) {}
public mayDisplay() {
- return this.context.nextUpgrade !== null && this.context.nextUpgrade !== this.context.current;
+ return this.context.suggestedUpgrade ? true : false;
}
public getInAppNotification(): InAppNotification {
@@ -24,7 +23,7 @@ export class UpdateAvailableNotificationProvider implements InAppNotificationPro
'in-app-notifications',
'Install Mullvad VPN (%(version)s) to stay up to date',
),
- { version: this.context.nextUpgrade },
+ { version: this.context.suggestedUpgrade },
);
return {