fix: auto tunnel service worker

This commit is contained in:
Zane Schepke
2025-10-16 00:27:02 -04:00
parent b30b0f3cd2
commit 60935c9ff1
7 changed files with 12 additions and 11 deletions
+1
View File
@@ -178,6 +178,7 @@ dependencies {
implementation(libs.bundles.hilt.android)
implementation(libs.bundles.androidx.work)
ksp(libs.hilt.android.compiler)
ksp(libs.androidx.hilt.compiler)
// Networking and serialization
implementation(libs.bundles.ktor.client)
@@ -121,6 +121,8 @@ constructor(
context.bindService(intent, autoTunnelServiceConnection, Context.BIND_AUTO_CREATE)
}
suspend fun startAutoTunnelService() = autoTunnelMutex.withLock { startServiceInternal() }
private fun stopServiceInternal() {
_autoTunnelService.value?.stop()
try {
@@ -47,7 +47,6 @@ constructor(
}
}
// TODO this needs to be changed
override suspend fun doWork(): Result =
withContext(ioDispatcher) {
Timber.i("Service worker started")
@@ -55,7 +54,7 @@ constructor(
Timber.i("Checking to see if auto-tunnel has been killed by system")
if (isAutoTunnelEnabled && serviceManager.autoTunnelService.value == null) {
Timber.i("Service has been killed by system, restoring.")
autoTunnelSettingsRepository.updateAutoTunnelEnabled(true)
serviceManager.startAutoTunnelService()
}
}
Result.success()