diff options
author | Arne Schwabe <arne@rfc2549.org> | 2024-08-09 17:08:21 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2024-08-09 17:09:53 +0200 |
commit | 6e9dcd42af2a25f77d90d28ca0e4a564654bc6b8 (patch) | |
tree | 767158fa02cb29b49ccb0a5f7ddb8e64bda06e6c | |
parent | 017fa17bb823698c02118e95f1fc501f0a12182d (diff) |
Make OpenVPN 3.x paused status a bit nicer
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java index 4f8e33a6..b1bfcaf5 100644 --- a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java +++ b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java @@ -311,17 +311,22 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable public void event(ClientAPI_Event event) { String name = event.getName(); String info = event.getInfo(); - if (name.equals("INFO")) { - if (info.startsWith("OPEN_URL:") || info.startsWith("CR_TEXT:") - || info.startsWith("WEB_AUTH:")) { - mService.trigger_sso(info); - } else { - VpnStatus.logInfo(R.string.info_from_server, info); + switch (name) { + case "INFO" -> { + if (info.startsWith("OPEN_URL:") || info.startsWith("CR_TEXT:") + || info.startsWith("WEB_AUTH:")) { + mService.trigger_sso(info); + } else { + VpnStatus.logInfo(R.string.info_from_server, info); + } } - } else if (name.equals("COMPRESSION_ENABLED") || name.equals(("WARN"))) { - VpnStatus.logInfo(String.format(Locale.US, "%s: %s", name, info)); - } else { - VpnStatus.updateStateString(name, info); + case "COMPRESSION_ENABLED", "WARN" -> + VpnStatus.logInfo(String.format(Locale.US, "%s: %s", name, info)); + case "PAUSE" -> + VpnStatus.updateStateString(name, "VPN connection paused", R.string.state_userpause, ConnectionStatus.LEVEL_VPNPAUSED); + case "RESUME" -> + VpnStatus.updateStateString(name, "VPN connection resumed", R.string.state_reconnecting, ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET); + default -> VpnStatus.updateStateString(name, info); } /* if (event.name.equals("DYNAMIC_CHALLENGE")) { ClientAPI_DynamicChallenge challenge = new ClientAPI_DynamicChallenge(); |