diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-05-20 22:22:10 +0200 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2025-05-28 13:25:41 +0200 |
| commit | be5c47a71b7d5886046271fbfde41b8406d688ee (patch) | |
| tree | fa2c709cb091bd11a6b94393956d59e95f6c86bd /desktop | |
| parent | 87f3b9ff98d100d37620f6b35ab3da2f923dff67 (diff) | |
| download | mullvadvpn-be5c47a71b7d5886046271fbfde41b8406d688ee.tar.xz mullvadvpn-be5c47a71b7d5886046271fbfde41b8406d688ee.zip | |
Make notification action conditionally navigate to AppUpgrade route
If an upgrade exists then the user can upgrade from within the app,
rather than visiting the website to download an installer.
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/shared/notifications/unsupported-version.ts | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/desktop/packages/mullvad-vpn/src/shared/notifications/unsupported-version.ts b/desktop/packages/mullvad-vpn/src/shared/notifications/unsupported-version.ts index 87138843a1..086b924a92 100644 --- a/desktop/packages/mullvad-vpn/src/shared/notifications/unsupported-version.ts +++ b/desktop/packages/mullvad-vpn/src/shared/notifications/unsupported-version.ts @@ -1,4 +1,5 @@ import { messages } from '../../shared/gettext'; +import { RoutePath } from '../../shared/routes'; import { AppVersionInfoSuggestedUpgrade } from '../daemon-rpc-types'; import { getDownloadUrl } from '../version'; import { @@ -31,13 +32,20 @@ export class UnsupportedVersionNotificationProvider message: this.getMessage(), category: SystemNotificationCategory.newVersion, severity: SystemNotificationSeverityType.high, - action: { - type: 'navigate-external', - link: { - text: messages.pgettext('notifications', 'Upgrade'), - to: getDownloadUrl(this.context.suggestedIsBeta ?? false), - }, - }, + action: this.context.suggestedUpgrade + ? { + type: 'navigate-internal', + link: { + to: RoutePath.appUpgrade, + }, + } + : { + type: 'navigate-external', + link: { + text: messages.pgettext('notifications', 'Upgrade'), + to: getDownloadUrl(this.context.suggestedIsBeta ?? false), + }, + }, presentOnce: { value: true, name: this.constructor.name }, suppressInDevelopment: true, }; @@ -48,12 +56,19 @@ export class UnsupportedVersionNotificationProvider indicator: 'error', title: messages.pgettext('in-app-notifications', 'UNSUPPORTED VERSION'), subtitle: this.getMessage(), - action: { - type: 'navigate-external', - link: { - to: getDownloadUrl(this.context.suggestedIsBeta ?? false), - }, - }, + action: this.context.suggestedUpgrade + ? { + type: 'navigate-internal', + link: { + to: RoutePath.appUpgrade, + }, + } + : { + type: 'navigate-external', + link: { + to: getDownloadUrl(this.context.suggestedIsBeta ?? false), + }, + }, }; } |
