diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-06-17 15:20:56 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-06-24 11:23:12 +0200 |
| commit | 2341e2eea669ed29e1146d012fa7a4e5dc9bebf6 (patch) | |
| tree | 47d17244c20745a0b71a6eca5b0947deea088704 /gui/src/shared/notifications/update-available.ts | |
| parent | ddf0ace17e8ca6cd27aa13c3db63e0d16ae504ba (diff) | |
| download | mullvadvpn-2341e2eea669ed29e1146d012fa7a4e5dc9bebf6.tar.xz mullvadvpn-2341e2eea669ed29e1146d012fa7a4e5dc9bebf6.zip | |
Rename notification provider files to kebab-case
Diffstat (limited to 'gui/src/shared/notifications/update-available.ts')
| -rw-r--r-- | gui/src/shared/notifications/update-available.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts new file mode 100644 index 0000000000..4d449bff28 --- /dev/null +++ b/gui/src/shared/notifications/update-available.ts @@ -0,0 +1,37 @@ +import { sprintf } from 'sprintf-js'; +import { links } from '../../config.json'; +import { messages } from '../../shared/gettext'; +import { InAppNotification, InAppNotificationProvider } from './notification'; + +interface UpdateAvailableNotificationContext { + current: string; + nextUpgrade: string | null; +} + +export class UpdateAvailableNotificationProvider implements InAppNotificationProvider { + public constructor(private context: UpdateAvailableNotificationContext) {} + + public mayDisplay() { + return this.context.nextUpgrade !== null && this.context.nextUpgrade !== this.context.current; + } + + public getInAppNotification(): InAppNotification { + const subtitle = sprintf( + // TRANSLATORS: The in-app banner displayed to the user when the app update is available. + // TRANSLATORS: Available placeholders: + // TRANSLATORS: %(version)s - the newest available version of the app + messages.pgettext( + 'in-app-notifications', + 'Install Mullvad VPN (%(version)s) to stay up to date', + ), + { version: this.context.nextUpgrade }, + ); + + return { + indicator: 'warning', + title: messages.pgettext('in-app-notifications', 'UPDATE AVAILABLE'), + subtitle, + action: { type: 'open-url', url: links.download }, + }; + } +} |
