summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared/notifications/reconnecting.ts
blob: 9c20cad8c9fb7dc4f3f0d1f01f26605012168a6c (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
import { messages } from '../../shared/gettext';
import { TunnelState } from '../daemon-rpc-types';
import {
  InAppNotification,
  InAppNotificationProvider,
  SystemNotificationProvider,
} from './notification';

export class ReconnectingNotificationProvider
  implements SystemNotificationProvider, InAppNotificationProvider {
  public constructor(private context: TunnelState) {}

  public mayDisplay() {
    return this.context.state === 'disconnecting' && this.context.details === 'reconnect';
  }

  public getSystemNotification() {
    return {
      message: messages.pgettext('notifications', 'Reconnecting'),
      critical: false,
    };
  }

  public getInAppNotification(): InAppNotification {
    return {
      title: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'),
    };
  }
}