From 6031d85edd56143cf4bdfdb679c695f7423c06bc Mon Sep 17 00:00:00 2001 From: Zane Schepke Date: Sat, 15 Mar 2025 00:16:02 -0400 Subject: [PATCH] fix: re-enable shortcuts Closes #616 --- .../core/shortcut/ShortcutsActivity.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/core/shortcut/ShortcutsActivity.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/core/shortcut/ShortcutsActivity.kt index 41f58300..0b12b004 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/core/shortcut/ShortcutsActivity.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/core/shortcut/ShortcutsActivity.kt @@ -6,6 +6,7 @@ import com.zaneschepke.wireguardautotunnel.domain.repository.AppDataRepository import com.zaneschepke.wireguardautotunnel.di.ApplicationScope import com.zaneschepke.wireguardautotunnel.core.service.ServiceManager import com.zaneschepke.wireguardautotunnel.core.service.autotunnel.AutoTunnelService +import com.zaneschepke.wireguardautotunnel.core.tunnel.TunnelManager import com.zaneschepke.wireguardautotunnel.core.tunnel.TunnelProvider import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope @@ -21,6 +22,9 @@ class ShortcutsActivity : ComponentActivity() { @Inject lateinit var serviceManager: ServiceManager + @Inject + lateinit var tunnelManager: TunnelManager + @Inject @ApplicationScope lateinit var applicationScope: CoroutineScope @@ -39,13 +43,13 @@ class ShortcutsActivity : ComponentActivity() { .firstOrNull { it.tunName == tunnelName } } ?: appDataRepository.getStartTunnelConfig() Timber.d("Shortcut action on name: ${tunnelConfig?.tunName}") -// tunnelConfig?.let { -// when (intent.action) { -// Action.START.name -> tunnelService.get().startTunnel(it) -// Action.STOP.name -> tunnelService.get().stopTunnel() -// else -> Unit -// } -// } + tunnelConfig?.let { + when (intent.action) { + Action.START.name -> tunnelManager.startTunnel(it) + Action.STOP.name -> tunnelManager.stopTunnel() + else -> Unit + } + } } AutoTunnelService::class.java.simpleName, LEGACY_AUTO_TUNNEL_SERVICE_NAME -> { when (intent.action) {