summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-08-09 09:56:15 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-08-22 08:34:37 +0200
commit8feded87c6f13d4caaeca6114b1cd964a4b9a051 (patch)
tree50e5c8296fdd088f292a6c9642dbda3ad1b0c0de /gui/src
parent52f09be3760a2744cba00ac2a5eb52b14ba6b726 (diff)
downloadmullvadvpn-8feded87c6f13d4caaeca6114b1cd964a4b9a051.tar.xz
mullvadvpn-8feded87c6f13d4caaeca6114b1cd964a4b9a051.zip
Move functions within index.ts
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/index.ts58
1 files changed, 27 insertions, 31 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 4f1769bba9..3fca018236 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -186,6 +186,29 @@ class ApplicationMain
}
}
+ public connectTunnel = async (): Promise<void> => {
+ if (this.tunnelState.allowConnect(this.daemonRpc.isConnected, this.account.isLoggedIn())) {
+ this.tunnelState.expectNextTunnelState('connecting');
+ await this.daemonRpc.connectTunnel();
+ }
+ };
+
+ public reconnectTunnel = async (): Promise<void> => {
+ if (this.tunnelState.allowReconnect(this.daemonRpc.isConnected, this.account.isLoggedIn())) {
+ this.tunnelState.expectNextTunnelState('connecting');
+ await this.daemonRpc.reconnectTunnel();
+ }
+ };
+
+ public disconnectTunnel = async (): Promise<void> => {
+ if (this.tunnelState.allowDisconnect(this.daemonRpc.isConnected)) {
+ this.tunnelState.expectNextTunnelState('disconnecting');
+ await this.daemonRpc.disconnectTunnel();
+ }
+ };
+
+ public isLoggedIn = () => this.account.isLoggedIn();
+
private addSecondInstanceEventHandler() {
app.on('second-instance', (_event, argv, _workingDirectory) => {
if (argv.includes(CommandLineOptions.quitWithoutDisconnect)) {
@@ -940,31 +963,9 @@ class ApplicationMain
public isConnectedToDaemon = () => this.daemonRpc.isConnected;
public getTunnelState = () => this.tunnelState.tunnelState;
public updateAccountData = () => this.account.updateAccountData();
- public isLoggedIn = () => this.account.isLoggedIn();
public isBrowsingFiles = () => this.browsingFiles;
public getAccountData = () => this.account.accountData;
- public connectTunnel = async (): Promise<void> => {
- if (this.tunnelState.allowConnect(this.daemonRpc.isConnected, this.account.isLoggedIn())) {
- this.tunnelState.expectNextTunnelState('connecting');
- await this.daemonRpc.connectTunnel();
- }
- };
-
- public reconnectTunnel = async (): Promise<void> => {
- if (this.tunnelState.allowReconnect(this.daemonRpc.isConnected, this.account.isLoggedIn())) {
- this.tunnelState.expectNextTunnelState('connecting');
- await this.daemonRpc.reconnectTunnel();
- }
- };
-
- public disconnectTunnel = async (): Promise<void> => {
- if (this.tunnelState.allowDisconnect(this.daemonRpc.isConnected)) {
- this.tunnelState.expectNextTunnelState('disconnecting');
- await this.daemonRpc.disconnectTunnel();
- }
- };
-
// VersionDelegate
public notify = (notification: SystemNotification) => {
this.notificationController.notify(notification);
@@ -993,19 +994,14 @@ class ApplicationMain
};
// SettingsDelegate
- public async handleMonochromaticIconChange(value: boolean) {
- await this.userInterface?.setUseMonochromaticTrayIcon(value);
- }
- public handleUnpinnedWindowChange() {
- void this.userInterface?.recreateWindow();
- }
+ public handleMonochromaticIconChange = (value: boolean) =>
+ this.userInterface?.setUseMonochromaticTrayIcon(value) ?? Promise.resolve();
+ public handleUnpinnedWindowChange = () => void this.userInterface?.recreateWindow();
// AccountDelegate
public getLocale = () => this.locale;
public isPerformingPostUpgradeCheck = () => this.isPerformingPostUpgrade;
- public setTrayContextMenu() {
- this.userInterface?.setTrayContextMenu();
- }
+ public setTrayContextMenu = () => this.userInterface?.setTrayContextMenu();
/* eslint-enable @typescript-eslint/member-ordering */
}