summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-02-27 19:04:18 +0100
committerFup Duck <fupduck@sacknagel.com>2018-02-27 19:04:18 +0100
commit9787e857bca4dca056d9e55cc9c8eaa1756eb990 (patch)
treeb6c9e853af25b1c5267aeb55cc59f133526fdc35 /app/src/main/java/se/leap/bitmaskclient
parent8a08d44facafd405e89e22b84dd82dfa3e85923c (diff)
8865 - disconnect without internet
* move function to dialog
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index 1a6ad8d2..cb98aaac 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -258,21 +258,10 @@ public class EipFragment extends Fragment implements Observer {
}
private void handleSwitchOff() {
- if (eipStatus.isConnecting()) {
+ if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting()) {
askPendingStartCancellation();
} else if (eipStatus.isConnected()) {
askToStopEIP();
- } else if (isOpenVpnRunningWithoutNetwork()) {
- // TODO move to EIP
- // TODO see stopEIP function
- Bundle resultData = new Bundle();
- resultData.putString(EIP_REQUEST, EIP_ACTION_STOP);
- Intent intentUpdate = new Intent(BROADCAST_EIP_EVENT);
- intentUpdate.addCategory(Intent.CATEGORY_DEFAULT);
- intentUpdate.putExtra(BROADCAST_RESULT_CODE, Activity.RESULT_OK);
- intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData);
- Log.d(TAG, "sending broadcast");
- LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentUpdate);
}
}
@@ -293,7 +282,20 @@ public class EipFragment extends Fragment implements Observer {
protected void stopEipIfPossible() {
Context context = getContext();
if (context != null) {
- EipCommand.stopVPN(getContext());
+ if (isOpenVpnRunningWithoutNetwork()) {
+ // TODO move to EIP
+ // TODO see stopEIP function
+ Bundle resultData = new Bundle();
+ resultData.putString(EIP_REQUEST, EIP_ACTION_STOP);
+ Intent intentUpdate = new Intent(BROADCAST_EIP_EVENT);
+ intentUpdate.addCategory(Intent.CATEGORY_DEFAULT);
+ intentUpdate.putExtra(BROADCAST_RESULT_CODE, Activity.RESULT_OK);
+ intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData);
+ Log.d(TAG, "sending broadcast");
+ LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentUpdate);
+ } else {
+ EipCommand.stopVPN(getContext());
+ }
} else {
Log.e(TAG, "context is null when trying to stop EIP");
}