summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/VpnFragment.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/VpnFragment.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
index eff02193..7b01714f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
@@ -32,11 +32,10 @@ import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
import de.blinkt.openvpn.core.OpenVPNService;
import de.blinkt.openvpn.core.ProfileManager;
import de.blinkt.openvpn.core.VpnStatus;
-import mbanje.kurt.fabbutton.*;
-import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.eip.EIP;
import se.leap.bitmaskclient.eip.EipStatus;
import se.leap.bitmaskclient.eip.VoidVpnService;
+import se.leap.bitmaskclient.userstatus.FabButton;
public class VpnFragment extends Fragment implements Observer {
@@ -115,7 +114,7 @@ public class VpnFragment extends Fragment implements Observer {
public void onResume() {
super.onResume();
//FIXME: avoid race conditions while checking certificate an logging in at about the same time
- //eipCommand(EIPConstants.ACTION_CHECK_CERT_VALIDITY);
+ //eipCommand(Constants.EIP_ACTION_CHECK_CERT_VALIDITY);
handleNewState(eip_status);
bindOpenVpnService();
}
@@ -164,13 +163,13 @@ public class VpnFragment extends Fragment implements Observer {
}
private boolean canStartEIP() {
- boolean certificateExists = !Dashboard.preferences.getString(EIPConstants.VPN_CERTIFICATE, "").isEmpty();
- boolean isAllowedAnon = Dashboard.preferences.getBoolean(EIPConstants.ALLOWED_ANON, false);
+ boolean certificateExists = !Dashboard.preferences.getString(Constants.VPN_CERTIFICATE, "").isEmpty();
+ boolean isAllowedAnon = Dashboard.preferences.getBoolean(Constants.ALLOWED_ANON, false);
return (isAllowedAnon || certificateExists) && !eip_status.isConnected() && !eip_status.isConnecting();
}
private boolean canLogInToStartEIP() {
- boolean isAllowedRegistered = Dashboard.preferences.getBoolean(EIPConstants.ALLOWED_REGISTERED, false);
+ boolean isAllowedRegistered = Dashboard.preferences.getBoolean(Constants.ALLOWED_REGISTERED, false);
boolean isLoggedIn = !LeapSRPSession.getToken().isEmpty();
return isAllowedRegistered && !isLoggedIn && !eip_status.isConnecting() && !eip_status.isConnected();
}
@@ -207,7 +206,7 @@ public class VpnFragment extends Fragment implements Observer {
eip_status.setConnecting();
saveStatus();
- eipCommand(EIPConstants.ACTION_START_EIP);
+ eipCommand(Constants.EIP_ACTION_START);
}
private void stop() {
@@ -230,7 +229,7 @@ public class VpnFragment extends Fragment implements Observer {
}
protected void stopEipIfPossible() {
- eipCommand(EIPConstants.ACTION_STOP_EIP);
+ eipCommand(Constants.EIP_ACTION_STOP);
}
private void downloadEIPServiceConfig() {
@@ -258,7 +257,7 @@ public class VpnFragment extends Fragment implements Observer {
}
protected void updateEipService() {
- eipCommand(EIPConstants.ACTION_UPDATE_EIP_SERVICE);
+ eipCommand(Constants.EIP_ACTION_UPDATE);
}
/**
@@ -271,7 +270,7 @@ public class VpnFragment extends Fragment implements Observer {
// TODO validate "action"...how do we get the list of intent-filters for a class via Android API?
Intent vpn_intent = new Intent(dashboard.getApplicationContext(), EIP.class);
vpn_intent.setAction(action);
- vpn_intent.putExtra(EIPConstants.RECEIVER_TAG, eip_receiver);
+ vpn_intent.putExtra(Constants.EIP_RECEIVER, eip_receiver);
dashboard.startService(vpn_intent);
}
@@ -344,9 +343,9 @@ public class VpnFragment extends Fragment implements Observer {
protected void onReceiveResult(int resultCode, Bundle resultData) {
super.onReceiveResult(resultCode, resultData);
- String request = resultData.getString(EIPConstants.REQUEST_TAG);
+ String request = resultData.getString(Constants.EIP_REQUEST);
- if (request.equals(EIPConstants.ACTION_START_EIP)) {
+ if (request.equals(Constants.EIP_ACTION_START)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
@@ -354,7 +353,7 @@ public class VpnFragment extends Fragment implements Observer {
break;
}
- } else if (request.equals(EIPConstants.ACTION_STOP_EIP)) {
+ } else if (request.equals(Constants.EIP_ACTION_STOP)) {
switch (resultCode) {
case Activity.RESULT_OK:
stop();
@@ -362,14 +361,14 @@ public class VpnFragment extends Fragment implements Observer {
case Activity.RESULT_CANCELED:
break;
}
- } else if (request.equals(EIPConstants.EIP_NOTIFICATION)) {
+ } else if (request.equals(Constants.EIP_NOTIFICATION)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
case Activity.RESULT_CANCELED:
break;
}
- } else if (request.equals(EIPConstants.ACTION_CHECK_CERT_VALIDITY)) {
+ } else if (request.equals(Constants.EIP_ACTION_CHECK_CERT_VALIDITY)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
@@ -377,7 +376,7 @@ public class VpnFragment extends Fragment implements Observer {
dashboard.downloadVpnCertificate();
break;
}
- } else if (request.equals(EIPConstants.ACTION_UPDATE_EIP_SERVICE)) {
+ } else if (request.equals(Constants.EIP_ACTION_UPDATE)) {
switch (resultCode) {
case Activity.RESULT_OK:
if (wants_to_connect)