diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-02-09 10:53:22 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-09 10:53:22 +0100 |
| commit | 9f9996b47029bceb9582ffdd5199a1db10287e8f (patch) | |
| tree | a867bca5026dc75a4378437c7ebd017ebb9fbf7e /gui/src/main/user-interface.ts | |
| parent | a452a38ed484da45d483150ca35a38705b007dfc (diff) | |
| parent | 8e4170b381f275f6aae787bffc624294b34be1b6 (diff) | |
| download | mullvadvpn-9f9996b47029bceb9582ffdd5199a1db10287e8f.tar.xz mullvadvpn-9f9996b47029bceb9582ffdd5199a1db10287e8f.zip | |
Merge branch 'improve-notifications'
Diffstat (limited to 'gui/src/main/user-interface.ts')
| -rw-r--r-- | gui/src/main/user-interface.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gui/src/main/user-interface.ts b/gui/src/main/user-interface.ts index 78af002c58..bc239cec2c 100644 --- a/gui/src/main/user-interface.ts +++ b/gui/src/main/user-interface.ts @@ -25,8 +25,7 @@ import WindowController, { WindowControllerDelegate } from './window-controller' const execAsync = promisify(exec); export interface UserInterfaceDelegate { - cancelPendingNotifications(): void; - resetTunnelStateAnnouncements(): void; + dismissActiveNotifications(): void; updateAccountData(): void; connectTunnel(): void; reconnectTunnel(): void; @@ -91,7 +90,7 @@ export default class UserInterface implements WindowControllerDelegate { monochromaticIcon: boolean, ) { const iconType = this.trayIconType(tunnelState, blockWhenDisconnected); - this.trayIconController = new TrayIconController(this.tray, iconType, monochromaticIcon); + this.trayIconController = new TrayIconController(this.tray, iconType, monochromaticIcon, false); } public async initializeWindow(isLoggedIn: boolean, tunnelState: TunnelState) { @@ -185,9 +184,11 @@ export default class UserInterface implements WindowControllerDelegate { public reloadWindow = () => this.windowController.window?.reload(); public isWindowVisible = () => this.windowController.isVisible(); public showWindow = () => this.windowController.show(); - public updateTrayTheme = () => this.trayIconController?.updateTheme(); - public setUseMonochromaticTrayIcon = (value: boolean) => - this.trayIconController?.setUseMonochromaticIcon(value); + public updateTrayTheme = () => this.trayIconController?.updateTheme() ?? Promise.resolve(); + public setMonochromaticIcon = (value: boolean) => + this.trayIconController?.setMonochromaticIcon(value); + public showNotificationIcon = (value: boolean) => + this.trayIconController?.showNotificationIcon(value); public setWindowIcon = (icon: string) => this.windowController.window?.setIcon(icon); public updateTrayIcon(tunnelState: TunnelState, blockWhenDisconnected: boolean) { @@ -319,7 +320,7 @@ export default class UserInterface implements WindowControllerDelegate { this.blurNavigationResetScheduler.cancel(); // cancel notifications when window appears - this.delegate.cancelPendingNotifications(); + this.delegate.dismissActiveNotifications(); const accountData = this.delegate.getAccountData(); if (!accountData || closeToExpiry(accountData.expiry, 4) || hasExpired(accountData.expiry)) { @@ -329,9 +330,6 @@ export default class UserInterface implements WindowControllerDelegate { this.windowController.window?.on('blur', () => { IpcMainEventChannel.window.notifyFocus?.(false); - - // ensure notification guard is reset - this.delegate.resetTunnelStateAnnouncements(); }); // Use hide instead of blur to prevent the navigation reset from happening when bluring an |
