diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-03-27 15:49:35 +0100 |
|---|---|---|
| committer | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-05-28 10:28:14 +0200 |
| commit | 69c1cdcd5099121b2d4bd27bf040c030ffdd43c3 (patch) | |
| tree | 666f3d6ea8d68108baf84aef6567c9dd482c4017 /desktop | |
| parent | 583520f61f7497732fd3a1fc3e07d8c31f3b0f4b (diff) | |
| download | mullvadvpn-69c1cdcd5099121b2d4bd27bf040c030ffdd43c3.tar.xz mullvadvpn-69c1cdcd5099121b2d4bd27bf040c030ffdd43c3.zip | |
Add App methods to conditionally start installer automatically
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/app.tsx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/app.tsx b/desktop/packages/mullvad-vpn/src/renderer/app.tsx index a0713f8880..be33983df9 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/app.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/app.tsx @@ -177,6 +177,9 @@ export default class AppRenderer { IpcRendererEventChannel.app.listenUpgradeEvent((appUpgradeEvent) => { this.reduxActions.appUpgrade.setAppUpgradeEvent(appUpgradeEvent); + + // Check if the installer should be started automatically + this.maybeStartAppUpgradeInstaller(); }); IpcRendererEventChannel.app.listenUpgradeError((appUpgradeError) => { @@ -189,6 +192,9 @@ export default class AppRenderer { IpcRendererEventChannel.upgradeVersion.listen((upgradeVersion: IAppVersionInfo) => { this.setUpgradeVersion(upgradeVersion); + + // Check if the installer should be started automatically + this.maybeStartAppUpgradeInstaller(); }); IpcRendererEventChannel.guiSettings.listen((guiSettings: IGuiSettingsState) => { @@ -635,6 +641,24 @@ export default class AppRenderer { } } + // If the installer has just been downloaded and verified we want to automatically + // start the installer if the window is focused. + private maybeStartAppUpgradeInstaller() { + const reduxState = this.reduxStore.getState(); + + const appUpgradeEvent = reduxState.appUpgrade.event; + const verifiedInstallerPath = reduxState.version.suggestedUpgrade?.verifiedInstallerPath; + const windowFocused = reduxState.userInterface.windowFocused; + + if ( + verifiedInstallerPath && + windowFocused && + appUpgradeEvent?.type === 'APP_UPGRADE_STATUS_VERIFIED_INSTALLER' + ) { + this.appUpgradeInstallerStart(); + } + } + private isLoggedIn(): boolean { return this.deviceState?.type === 'logged in'; } |
