summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java18
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java20
2 files changed, 22 insertions, 16 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
index 604a80fd..66e9bcb7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -347,7 +347,7 @@ public final class EIP extends JobIntentService implements Observer {
if (vpnok != R.string.no_error_found) {
VpnStatus.logError(R.string.config_error_found);
VpnStatus.logError(vpnok);
- setErrorResult(result, ERROR_INVALID_PROFILE.toString(), R.string.config_error_found);
+ setErrorResult(result, ERROR_INVALID_PROFILE.toString(), 0);
return;
}
@@ -432,14 +432,16 @@ public final class EIP extends JobIntentService implements Observer {
void setErrorResult(Bundle result, String errorId, @StringRes int errorMessageId, Object... args) {
JSONObject errorJson = new JSONObject();
try {
- String errorMessage;
- if (args != null) {
- errorMessage = getResources().getString(errorMessageId, args);
- } else {
- errorMessage = getResources().getString(errorMessageId);
+ if (errorMessageId != 0) {
+ String errorMessage;
+ if (args != null) {
+ errorMessage = getResources().getString(errorMessageId, args);
+ } else {
+ errorMessage = getResources().getString(errorMessageId);
+ }
+ VpnStatus.logWarning("[EIP] error: " + errorMessage);
+ errorJson.put(ERRORS, errorMessage);
}
- VpnStatus.logWarning("[EIP] error: " + errorMessage);
- errorJson.put(ERRORS, errorMessage);
errorJson.put(ERRORID, errorId);
} catch (JSONException e) {
e.printStackTrace();
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
index 2f27fd0d..1ad5f7d2 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
@@ -214,14 +214,18 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
case EIP_ACTION_START_ALWAYS_ON_VPN:
if (resultCode == RESULT_CANCELED) {
//setup failed
- if (error == EIP.EIPErrors.NO_MORE_GATEWAYS) {
- finishGatewaySetup(false);
- EipCommand.startBlockingVPN(context.getApplicationContext());
- } else {
- //FIXME:
- finishGatewaySetup(false);
- EipCommand.stopVPN(context);
- EipStatus.refresh();
+ switch (error) {
+ case NO_MORE_GATEWAYS:
+ finishGatewaySetup(false);
+ EipCommand.startBlockingVPN(context.getApplicationContext());
+ break;
+ case ERROR_INVALID_PROFILE:
+ selectNextGateway();
+ break;
+ default:
+ finishGatewaySetup(false);
+ EipCommand.stopVPN(context);
+ EipStatus.refresh();
}
}
break;