From b5ae47b29a9db017b10b3a6c610f8e127164adec Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Wed, 27 Nov 2024 09:10:06 +0100 Subject: [PATCH] Simplify grpc calls --- .../lib/daemon/grpc/ManagementService.kt | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt index 870859f95ff5..d4cedd1e61e4 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt @@ -62,7 +62,6 @@ import net.mullvad.mullvadvpn.lib.model.CustomList as ModelCustomList import net.mullvad.mullvadvpn.lib.model.CustomListAlreadyExists import net.mullvad.mullvadvpn.lib.model.CustomListId import net.mullvad.mullvadvpn.lib.model.CustomListName -import net.mullvad.mullvadvpn.lib.model.DaitaSettings import net.mullvad.mullvadvpn.lib.model.DeleteCustomListError import net.mullvad.mullvadvpn.lib.model.DeleteDeviceError import net.mullvad.mullvadvpn.lib.model.Device @@ -124,7 +123,6 @@ import net.mullvad.mullvadvpn.lib.model.WebsiteAuthToken import net.mullvad.mullvadvpn.lib.model.WireguardEndpointData as ModelWireguardEndpointData import net.mullvad.mullvadvpn.lib.model.addresses import net.mullvad.mullvadvpn.lib.model.customOptions -import net.mullvad.mullvadvpn.lib.model.directOnly import net.mullvad.mullvadvpn.lib.model.enabled import net.mullvad.mullvadvpn.lib.model.entryLocation import net.mullvad.mullvadvpn.lib.model.isMultihopEnabled @@ -510,21 +508,12 @@ class ManagementService( .mapEmpty() suspend fun setDaitaEnabled(enabled: Boolean): Either = - Either.catch { - val currentDaitaSettings = getSettings().tunnelOptions.wireguard.daitaSettings - val updatedDaitaSettings = DaitaSettings.enabled.set(currentDaitaSettings, enabled) - grpc.setDaitaSettings(updatedDaitaSettings.fromDomain()) - } + Either.catch { grpc.setEnableDaita(BoolValue.of(enabled)) } .mapLeft(SetDaitaSettingsError::Unknown) .mapEmpty() suspend fun setDaitaDirectOnly(enabled: Boolean): Either = - Either.catch { - val currentDaitaSettings = getSettings().tunnelOptions.wireguard.daitaSettings - val updatedDaitaSettings = - DaitaSettings.directOnly.set(currentDaitaSettings, enabled) - grpc.setDaitaSettings(updatedDaitaSettings.fromDomain()) - } + Either.catch { grpc.setDaitaDirectOnly(BoolValue.of(enabled)) } .mapLeft(SetDaitaSettingsError::Unknown) .mapEmpty()