diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-04-20 10:53:07 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-04-20 10:53:07 +0200 |
| commit | 4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9 (patch) | |
| tree | b0af816c5202d64b54d3f3b91b2da700399c019e /gui/src/main | |
| parent | fbdf3932b450ab65940f9f006db05cd35ff10704 (diff) | |
| parent | 87a7d264343b356d1acc746635346021fe7d3c6a (diff) | |
| download | mullvadvpn-4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9.tar.xz mullvadvpn-4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9.zip | |
Merge branch 'remember-location'
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 21 | ||||
| -rw-r--r-- | gui/src/main/window-controller.ts | 6 |
2 files changed, 23 insertions, 4 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index c39ccdbc5c..8acdac16a0 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -43,7 +43,12 @@ import { import { messages, relayLocations } from '../shared/gettext'; import { SYSTEM_PREFERRED_LOCALE_KEY } from '../shared/gui-settings-state'; import { ITranslations, MacOsScrollbarVisibility } from '../shared/ipc-schema'; -import { IChangelog, ICurrentAppVersionInfo } from '../shared/ipc-types'; +import { + IChangelog, + ICurrentAppVersionInfo, + IHistoryObject, + ScrollPositions, +} from '../shared/ipc-types'; import log, { ConsoleOutput, Logger } from '../shared/logging'; import { LogLevel } from '../shared/logging-types'; import { @@ -252,6 +257,9 @@ class ApplicationMain { private changelog?: IChangelog; + private navigationHistory?: IHistoryObject; + private scrollPositions: ScrollPositions = {}; + public run() { // Remove window animations to combat window flickering when opening window. Can be removed when // this issue has been resolved: https://github.com/electron/electron/issues/12130 @@ -1273,6 +1281,8 @@ class ApplicationMain { windowsSplitTunnelingApplications: this.windowsSplitTunnelingApplications, macOsScrollbarVisibility: this.macOsScrollbarVisibility, changelog: this.changelog ?? [], + navigationHistory: this.navigationHistory, + scrollPositions: this.scrollPositions, })); IpcMainEventChannel.settings.handleSetAllowLan((allowLan: boolean) => @@ -1486,6 +1496,13 @@ class ApplicationMain { this.guiSettings.changelogDisplayedForVersion = this.currentVersion.gui; }); + IpcMainEventChannel.navigation.handleSetHistory((history) => { + this.navigationHistory = history; + }); + IpcMainEventChannel.navigation.handleSetScrollPositions((scrollPositions) => { + this.scrollPositions = scrollPositions; + }); + if (windowsSplitTunneling) { this.guiSettings.browsedForSplitTunnelingApplications.forEach( windowsSplitTunneling.addApplicationPathToCache, @@ -1650,7 +1667,7 @@ class ApplicationMain { const window = await this.createWindow(); - this.windowController.destroy(); + this.windowController.close(); this.windowController = new WindowController( window, this.tray, diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts index 4676dbbecb..b737f4da96 100644 --- a/gui/src/main/window-controller.ts +++ b/gui/src/main/window-controller.ts @@ -192,9 +192,11 @@ export default class WindowController { this.notifyUpdateWindowShape(); } - public destroy() { + public close() { if (this.window && !this.window.isDestroyed()) { - this.window.destroy(); + this.window.webContents.closeDevTools(); + this.window.closable = true; + this.window.close(); } } |
