blob: 6dcc3cc7498c137e62374b78ee21ad9c5ae2a9eb (
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 { messages } from '../../shared/gettext';
import { TunnelState } from '../daemon-rpc-types';
import { InAppNotification, InAppNotificationProvider } from './notification';
interface BlockWhenDisconnectedNotificationContext {
tunnelState: TunnelState;
blockWhenDisconnected: boolean;
hasExcludedApps: boolean;
}
export class BlockWhenDisconnectedNotificationProvider implements InAppNotificationProvider {
public constructor(private context: BlockWhenDisconnectedNotificationContext) {}
public mayDisplay() {
return (
(this.context.tunnelState.state === 'disconnecting' ||
this.context.tunnelState.state === 'disconnected') &&
this.context.blockWhenDisconnected
);
}
public getInAppNotification(): InAppNotification {
let subtitle = messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.');
if (this.context.hasExcludedApps) {
subtitle = `${subtitle} ${messages.pgettext(
'notifications',
'The apps excluded with split tunneling might not work properly right now.',
)}`;
}
return {
indicator: 'warning',
title: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'),
subtitle,
};
}
}
|