blob: d3867650877aeb19eae8c7f818cdc857a5a35af3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import { sprintf } from 'sprintf-js';
import { links } from '../../config.json';
import { messages } from '../../shared/gettext';
import { InAppNotification, InAppNotificationProvider } from './notification';
interface UpdateAvailableNotificationContext {
suggestedUpgrade?: string;
}
export class UpdateAvailableNotificationProvider implements InAppNotificationProvider {
public constructor(private context: UpdateAvailableNotificationContext) {}
public mayDisplay() {
return this.context.suggestedUpgrade ? true : false;
}
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.suggestedUpgrade },
);
return {
indicator: 'warning',
title: messages.pgettext('in-app-notifications', 'UPDATE AVAILABLE'),
subtitle,
action: { type: 'open-url', url: links.download },
};
}
}
|