blob: 16b65c067210b227ae30830a014bd712eb2e6135 (
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
38
39
40
|
import { messages } from '../../shared/gettext';
import { TunnelState } from '../daemon-rpc-types';
import {
InAppNotification,
InAppNotificationProvider,
SystemNotificationProvider,
} from './notification';
interface BlockWhenDisconnectedNotificationContext {
tunnelState: TunnelState;
blockWhenDisconnected: boolean;
}
export class BlockWhenDisconnectedNotificationProvider
implements InAppNotificationProvider, SystemNotificationProvider {
public constructor(private context: BlockWhenDisconnectedNotificationContext) {}
public mayDisplay() {
return (
(this.context.tunnelState.state === 'disconnecting' ||
this.context.tunnelState.state === 'disconnected') &&
this.context.blockWhenDisconnected
);
}
public getSystemNotification() {
return {
message: messages.pgettext('notifications', 'Blocking internet'),
critical: false,
};
}
public getInAppNotification(): InAppNotification {
return {
indicator: 'error',
title: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'),
subtitle: messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.'),
};
}
}
|