summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/ProviderAPI.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-10-15 12:26:49 +0200
committerParménides GV <parmegv@sdf.org>2013-12-10 18:12:33 +0100
commit4460a3cb0dfe10a32ce6697047c7331536233d91 (patch)
treec7fe279395f409158b5e5690b624aa25da2a4eaa /src/se/leap/bitmaskclient/ProviderAPI.java
parent6c586abf63ea033fbc24451748f7103f54816625 (diff)
Download results stored in static variables.
ProviderAPI has now 3 different static variables, each one for the 3 files that have to be downloaded to set up a provider.
Diffstat (limited to 'src/se/leap/bitmaskclient/ProviderAPI.java')
-rw-r--r--src/se/leap/bitmaskclient/ProviderAPI.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderAPI.java b/src/se/leap/bitmaskclient/ProviderAPI.java
index b23bdc7f..bf3cf662 100644
--- a/src/se/leap/bitmaskclient/ProviderAPI.java
+++ b/src/se/leap/bitmaskclient/ProviderAPI.java
@@ -118,6 +118,11 @@ public class ProviderAPI extends IntentService {
INCORRECTLY_DOWNLOADED_ANON_CERTIFICATE = 14
;
+ public static boolean
+ CA_CERT_DOWNLOADED = false,
+ PROVIDER_JSON_DOWNLOADED = false,
+ EIP_SERVICE_JSON_DOWNLOADED = false
+ ;
public ProviderAPI() {
super("ProviderAPI");
Log.v("ClassName", "Provider API");
@@ -136,14 +141,14 @@ public class ProviderAPI extends IntentService {
@Override
protected void onHandleIntent(Intent command) {
- final ResultReceiver receiver = command.getParcelableExtra("receiver");
+ final ResultReceiver receiver = command.getParcelableExtra(RECEIVER_KEY);
String action = command.getAction();
Bundle parameters = command.getBundleExtra(PARAMETERS);
if(action.equalsIgnoreCase(SET_UP_PROVIDER)) {
Bundle result = setUpProvider(parameters);
if(result.getBoolean(RESULT_KEY)) {
- receiver.send(PROVIDER_OK, result);
+ receiver.send(PROVIDER_OK, Bundle.EMPTY);
} else {
receiver.send(PROVIDER_NOK, Bundle.EMPTY);
}
@@ -424,15 +429,24 @@ public class ProviderAPI extends IntentService {
int progress = 0;
boolean danger_on = task.getBoolean(ProviderItem.DANGER_ON);
String provider_main_url = task.getString(Provider.MAIN_URL);
+
+ result.putBoolean(RESULT_KEY, false);
if(downloadCACert(provider_main_url, danger_on)) {
broadcast_progress(progress++);
- result.putBoolean(RESULT_KEY, true);
+ CA_CERT_DOWNLOADED = true;
if(getAndSetProviderJson(provider_main_url)) {
broadcast_progress(progress++);
- if(getAndSetEipServiceJson())
+ PROVIDER_JSON_DOWNLOADED = true;
+ if(getAndSetEipServiceJson()) {
broadcast_progress(progress++);
+ EIP_SERVICE_JSON_DOWNLOADED = true;
+ }
}
}
+
+ if(CA_CERT_DOWNLOADED && PROVIDER_JSON_DOWNLOADED && EIP_SERVICE_JSON_DOWNLOADED)
+ result.putBoolean(RESULT_KEY, true);
+
return result;
}