From b3ea137781af2eacd0a5b75f24030cfbc3c9d962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 13 Jan 2015 13:48:34 +0100 Subject: Reusing methods to download certificate. This makes sure that if a a certificate is not valid, a new one is downloaded. Unit tests don't apply to this, I've already added one to the certificate validator, whose result will determine if a new certificate will be downloaded. --- .../release/java/se/leap/bitmaskclient/ProviderAPI.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java') diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index d019ca59..334efaa9 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -182,7 +182,7 @@ public class ProviderAPI extends IntentService { if(validUserLoginData(username, password)) { session_id_bundle = register(username, password); - broadcast_progress(progress++); + broadcastProgress(progress++); } else { if(!wellFormedPassword(password)) { session_id_bundle.putBoolean(RESULT_KEY, false); @@ -232,7 +232,7 @@ public class ProviderAPI extends IntentService { String password = (String) task.get(SessionDialog.PASSWORD); if(validUserLoginData(username, password)) { result = authenticate(username, password); - broadcast_progress(progress++); + broadcastProgress(progress++); } else { if(!wellFormedPassword(password)) { result.putBoolean(RESULT_KEY, false); @@ -312,7 +312,7 @@ public class ProviderAPI extends IntentService { * and sends it as a broadcast. * @param progress */ - private void broadcast_progress(int progress) { + private void broadcastProgress(int progress) { Intent intentUpdate = new Intent(); intentUpdate.setAction(UPDATE_PROGRESSBAR); intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); @@ -497,17 +497,17 @@ public class ProviderAPI extends IntentService { if(!PROVIDER_JSON_DOWNLOADED) current_download = getAndSetProviderJson(last_provider_main_url); if(PROVIDER_JSON_DOWNLOADED || (current_download.containsKey(RESULT_KEY) && current_download.getBoolean(RESULT_KEY))) { - broadcast_progress(progress++); + broadcastProgress(progress++); PROVIDER_JSON_DOWNLOADED = true; if(!CA_CERT_DOWNLOADED) current_download = downloadCACert(); if(CA_CERT_DOWNLOADED || (current_download.containsKey(RESULT_KEY) && current_download.getBoolean(RESULT_KEY))) { - broadcast_progress(progress++); + broadcastProgress(progress++); CA_CERT_DOWNLOADED = true; current_download = getAndSetEipServiceJson(); if(current_download.containsKey(RESULT_KEY) && current_download.getBoolean(RESULT_KEY)) { - broadcast_progress(progress++); + broadcastProgress(progress++); EIP_SERVICE_JSON_DOWNLOADED = true; } } @@ -833,7 +833,7 @@ public class ProviderAPI extends IntentService { urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory()); responseCode = urlConnection.getResponseCode(); - broadcast_progress(progress++); + broadcastProgress(progress++); LeapSRPSession.setToken(""); Log.d(TAG, Integer.toString(responseCode)); } catch (ClientProtocolException e) { @@ -850,7 +850,7 @@ public class ProviderAPI extends IntentService { if(urlConnection != null) { responseCode = urlConnection.getResponseCode(); if(responseCode == 401) { - broadcast_progress(progress++); + broadcastProgress(progress++); LeapSRPSession.setToken(""); Log.d(TAG, Integer.toString(responseCode)); return true; -- cgit v1.2.3