summaryrefslogtreecommitdiff
path: root/app/src/insecure/java/se/leap
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-02-09 18:29:51 +0100
committerFup Duck <fupduck@sacknagel.com>2018-02-09 18:29:51 +0100
commit7f84522ce01e8bcf1b3063ff7fa19a9a7dca61ea (patch)
tree07dc1cecf8c46e764a3ab89143c861f5b3073354 /app/src/insecure/java/se/leap
parent9f6e74680e5cfe6507bd1e37ea217cf2887af3cc (diff)
8827 - resolve discussions
* use LocalBroadcastManager for broadcasts * add NullPointer checks to EipFragment * store VpnCertificate & private key in Provider not preferences * EipFragment uses provider instead of reading from preferences * use switch in ProviderApiManager
Diffstat (limited to 'app/src/insecure/java/se/leap')
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
index dfc98ffb..d57dfe6d 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
@@ -171,9 +171,15 @@ public class ProviderApiManager extends ProviderApiManagerBase {
eipServiceJsonString = downloadWithProviderCA(provider.getCaCert(), eipServiceUrl, lastDangerOn);
JSONObject eipServiceJson = new JSONObject(eipServiceJsonString);
- provider.setEipServiceJson(eipServiceJson);
- result.putBoolean(BROADCAST_RESULT_KEY, true);
+ if (eipServiceJson.has(ERRORS)) {
+ String reasonToFail = pickErrorMessage(eipServiceJsonString);
+ result.putString(ERRORS, reasonToFail);
+ result.putBoolean(BROADCAST_RESULT_KEY, false);
+ } else{
+ provider.setEipServiceJson(eipServiceJson);
+ result.putBoolean(BROADCAST_RESULT_KEY, true);
+ }
} catch (NullPointerException | JSONException e) {
String reasonToFail = pickErrorMessage(eipServiceJsonString);
result.putString(ERRORS, reasonToFail);
@@ -201,7 +207,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
if (certString == null || certString.isEmpty() || ConfigHelper.checkErroneousDownload(certString))
return false;
else
- return loadCertificate(certString);
+ return loadCertificate(provider, certString);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();