blob: 4d449bff28211bef518d8f3440c726b2f78d1f1b (
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
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 },
};
}
}
|