From b81f43c7cf33f575176acfbfee9daf405555eaa1 Mon Sep 17 00:00:00 2001 From: Marko Zajc <63c4689541bdcc9d.marko@zajc.tel> Date: Sat, 14 Dec 2024 16:18:35 +0000 Subject: [PATCH] fix: getting the SSID via shell (#494) --- .../wireguardautotunnel/util/extensions/TunnelExtensions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/extensions/TunnelExtensions.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/extensions/TunnelExtensions.kt index 6e9f9a8..e49ef3a 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/extensions/TunnelExtensions.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/extensions/TunnelExtensions.kt @@ -84,8 +84,8 @@ fun Config.toWgQuickString(): String { fun RootShell.getCurrentWifiName(): String? { val response = mutableListOf() - this.run(response, "dumpsys wifi | grep -o \"SSID: [^,]*\" | cut -d ' ' -f2- | tr -d '\"'") - return response.lastOrNull() + this.run(response, "dumpsys wifi | grep 'Supplicant state: COMPLETED' | grep -o 'SSID: [^,]*' | cut -d ' ' -f2- | tr -d '\"'") + return response.firstOrNull() } fun Backend.BackendState.asBackendState(): BackendState {