From 767bb8de42b9529b60858fc43e07b1d050ccd785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 9 Mar 2015 12:05:32 +0100 Subject: Eip status disconnects void vpn when disconnecting. --- app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java index 4ac3bd6a..f3f6e16f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java @@ -50,9 +50,11 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { current_status.setLocalizedResId(localizedResId); current_status.setLevel(level); current_status.setChanged(); - if(isConnected() || isDisconnected()) + if(isConnected() || isDisconnected()) { setConnectedOrDisconnected(); - else if(isConnecting()) + if(isDisconnected()) + VoidVpnService.stop(); + } else if(isConnecting()) setConnecting(); Log.d(TAG, "update state with level " + level); current_status.notifyObservers(); -- cgit v1.2.3 From 767f2982ec62e071396226415f5abda2fb6cb3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 9 Mar 2015 12:15:09 +0100 Subject: Extracted a new method, refactoring. --- .../main/java/se/leap/bitmaskclient/eip/EipStatus.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java index f3f6e16f..c6735130 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java @@ -44,12 +44,7 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { @Override public void updateState(final String state, final String logmessage, final int localizedResId, final VpnStatus.ConnectionStatus level) { - current_status = getInstance(); - current_status.setState(state); - current_status.setLogMessage(logmessage); - current_status.setLocalizedResId(localizedResId); - current_status.setLevel(level); - current_status.setChanged(); + updateStatus(state, logmessage, localizedResId, level); if(isConnected() || isDisconnected()) { setConnectedOrDisconnected(); if(isDisconnected()) @@ -57,7 +52,15 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { } else if(isConnecting()) setConnecting(); Log.d(TAG, "update state with level " + level); - current_status.notifyObservers(); + } + + private void updateStatus(final String state, final String logmessage, final int localizedResId, final VpnStatus.ConnectionStatus level) { + current_status = getInstance(); + current_status.setState(state); + current_status.setLogMessage(logmessage); + current_status.setLocalizedResId(localizedResId); + current_status.setLevel(level); + current_status.setChanged(); } public boolean wantsToDisconnect() { -- cgit v1.2.3