diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-06-25 22:05:09 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-07-22 15:49:04 +0200 |
| commit | 949a10c45541112c8066ea2cbb2d0692024e8ed9 (patch) | |
| tree | ee2f0f5467647dc28ca0eb9db3dbe27c5037c4f2 /gui/src | |
| parent | bcd90f658557b7a01e03eb97d9d21ef817e4b07a (diff) | |
| download | mullvadvpn-949a10c45541112c8066ea2cbb2d0692024e8ed9.tar.xz mullvadvpn-949a10c45541112c8066ea2cbb2d0692024e8ed9.zip | |
Make notifications open app on click
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/index.ts | 1 | ||||
| -rw-r--r-- | gui/src/main/notification-controller.ts | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index d6a01e6fd1..18dfc67d29 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -84,6 +84,7 @@ type AccountVerification = { status: 'verified' } | { status: 'deferred'; error: class ApplicationMain { private notificationController = new NotificationController({ + openApp: () => this.windowController?.show(), openLink: (url: string, withAuth?: boolean) => this.openLink(url, withAuth), isWindowVisible: () => this.windowController?.isVisible() ?? false, areSystemNotificationsEnabled: () => this.guiSettings.enableSystemNotifications, diff --git a/gui/src/main/notification-controller.ts b/gui/src/main/notification-controller.ts index 20c29d0a41..387b7fc634 100644 --- a/gui/src/main/notification-controller.ts +++ b/gui/src/main/notification-controller.ts @@ -16,6 +16,7 @@ import { import consumePromise from '../shared/promise'; interface NotificationControllerDelegate { + openApp(): void; openLink(url: string, withAuth?: boolean): Promise<void>; isWindowVisible(): boolean; areSystemNotificationsEnabled(): boolean; @@ -114,9 +115,17 @@ export default class NotificationController { }); if (systemNotification.action) { - const { withAuth, url } = systemNotification.action; notification.on('click', () => { - consumePromise(this.notificationControllerDelegate.openLink(url, withAuth)); + consumePromise( + this.notificationControllerDelegate.openLink( + systemNotification.action!.url, + systemNotification.action!.withAuth, + ), + ); + }); + } else { + notification.on('click', () => { + this.notificationControllerDelegate.openApp(); }); } |
