diff options
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/index.ts | 7 | ||||
| -rw-r--r-- | gui/src/main/notification-controller.ts | 9 | ||||
| -rw-r--r-- | gui/src/shared/notifications/daemon-disconnected.ts | 22 | ||||
| -rw-r--r-- | gui/src/shared/notifications/notification.ts | 1 |
4 files changed, 39 insertions, 0 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 37f6eaa590..635b0ad79e 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -623,6 +623,13 @@ class ApplicationMain // Reset the daemon event listener since it's going to be invalidated on disconnect this.daemonEventListener = undefined; + if (this.tunnelState.tunnelState.state !== 'disconnected') { + this.notificationController.notifyDaemonDisconnected( + this.userInterface?.isWindowVisible() ?? false, + this.settings.gui.enableSystemNotifications, + ); + } + this.tunnelState.resetFallback(); if (wasConnected) { diff --git a/gui/src/main/notification-controller.ts b/gui/src/main/notification-controller.ts index 8751ecb6ae..3639ac25eb 100644 --- a/gui/src/main/notification-controller.ts +++ b/gui/src/main/notification-controller.ts @@ -7,6 +7,7 @@ import log from '../shared/logging'; import { ConnectedNotificationProvider, ConnectingNotificationProvider, + DaemonDisconnectedNotificationProvider, DisconnectedNotificationProvider, ErrorNotificationProvider, NotificationAction, @@ -120,6 +121,14 @@ export default class NotificationController { return false; } + public notifyDaemonDisconnected(windowVisible: boolean, infoNotificationsEnabled: boolean) { + this.notify( + new DaemonDisconnectedNotificationProvider().getSystemNotification(), + windowVisible, + infoNotificationsEnabled, + ); + } + // Closes still relevant notifications but still lets them affect notification dot in tray icon. public dismissActiveNotifications() { this.activeNotifications.forEach((notification) => { diff --git a/gui/src/shared/notifications/daemon-disconnected.ts b/gui/src/shared/notifications/daemon-disconnected.ts new file mode 100644 index 0000000000..50a62266d0 --- /dev/null +++ b/gui/src/shared/notifications/daemon-disconnected.ts @@ -0,0 +1,22 @@ +import { messages } from '../../shared/gettext'; +import { + SystemNotification, + SystemNotificationCategory, + SystemNotificationProvider, + SystemNotificationSeverityType, +} from './notification'; + +export class DaemonDisconnectedNotificationProvider implements SystemNotificationProvider { + public mayDisplay = () => true; + + public getSystemNotification(): SystemNotification { + return { + message: messages.pgettext( + 'notifications', + 'Connection might be unsecured. App lost contact with system service, please troubleshoot.', + ), + severity: SystemNotificationSeverityType.high, + category: SystemNotificationCategory.tunnelState, + }; + } +} diff --git a/gui/src/shared/notifications/notification.ts b/gui/src/shared/notifications/notification.ts index b8727739ef..1957cc07fb 100644 --- a/gui/src/shared/notifications/notification.ts +++ b/gui/src/shared/notifications/notification.ts @@ -72,6 +72,7 @@ export * from './block-when-disconnected'; export * from './connected'; export * from './connecting'; export * from './disconnected'; +export * from './daemon-disconnected'; export * from './error'; export * from './inconsistent-version'; export * from './reconnecting'; |
