diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-06-30 11:08:42 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-01 17:09:18 +0200 |
| commit | 66e06eab444439e284e489533ab3c3e4a2fcf97d (patch) | |
| tree | b07cce345ff4a217b88da29530f80fc8dc93cec0 /gui/src/shared | |
| parent | bc19f9d15e30ee3b6cea233c60995b9a70368af0 (diff) | |
| download | mullvadvpn-66e06eab444439e284e489533ab3c3e4a2fcf97d.tar.xz mullvadvpn-66e06eab444439e284e489533ab3c3e4a2fcf97d.zip | |
Update the app update notification to specify if it's a beta version
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/notifications/update-available.ts | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts index 83c5d2348d..54dcc02ca8 100644 --- a/gui/src/shared/notifications/update-available.ts +++ b/gui/src/shared/notifications/update-available.ts @@ -1,3 +1,4 @@ +import { sprintf } from 'sprintf-js'; import { links } from '../../config.json'; import { messages } from '../../shared/gettext'; import { @@ -23,12 +24,10 @@ export class UpdateAvailableNotificationProvider public getInAppNotification(): InAppNotification { return { indicator: 'warning', - title: messages.pgettext('in-app-notifications', 'UPDATE AVAILABLE'), - // TRANSLATORS: The in-app banner displayed to the user when the app update is available. - subtitle: messages.pgettext( - 'in-app-notifications', - 'Install the latest app version to stay up to date.', - ), + title: this.context.suggestedIsBeta + ? messages.pgettext('in-app-notifications', 'BETA UPDATE AVAILABLE') + : messages.pgettext('in-app-notifications', 'UPDATE AVAILABLE'), + subtitle: this.inAppMessage(), action: { type: 'open-url', url: this.context.suggestedIsBeta ? links.betaDownload : links.download, @@ -38,10 +37,7 @@ export class UpdateAvailableNotificationProvider public getSystemNotification(): SystemNotification { return { - message: messages.pgettext( - 'notifications', - 'Update available. Install the latest app version to stay up to date', - ), + message: this.systemMessage(), critical: false, action: { type: 'open-url', @@ -52,4 +48,44 @@ export class UpdateAvailableNotificationProvider suppressInDevelopment: true, }; } + + private inAppMessage(): string { + if (this.context.suggestedIsBeta) { + return sprintf( + // TRANSLATORS: The in-app banner displayed to the user when the app beta update is + // TRANSLATORS: available. + // TRANSLATORS: Available placeholders: + // TRANSLATORS: %(version)s - The version number of the new beta version. + messages.pgettext('in-app-notifications', 'Try out the newest beta version (%(version)s).'), + { version: this.context.suggestedUpgrade }, + ); + } else { + // TRANSLATORS: The in-app banner displayed to the user when the app update is available. + return messages.pgettext( + 'in-app-notifications', + 'Install the latest app version to stay up to date.', + ); + } + } + + private systemMessage(): string { + if (this.context.suggestedIsBeta) { + return sprintf( + // TRANSLATORS: The system notification that notifies the user when a beta update is + // TRANSLATORS: available. + // TRANSLATORS: Available placeholders: + // TRANSLATORS: %(version)s - The version number of the new beta version. + messages.pgettext( + 'notifications', + 'Beta update available. Try out the newest beta version (%(version)s).', + ), + { version: this.context.suggestedUpgrade }, + ); + } else { + return messages.pgettext( + 'notifications', + 'Update available. Install the latest app version to stay up to date', + ); + } + } } |
