diff options
author | Parménides GV <parmegv@sdf.org> | 2014-12-09 14:08:17 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-12-09 14:08:17 +0100 |
commit | 5978db9bf758b7b229616d0575e327c58ad8cf94 (patch) | |
tree | fd8e968d07cf1e053713b41250fd7bae8ca2ec59 /app/src/release | |
parent | afc9998ebefb19fcb2f9e3c46c6430fd69262e47 (diff) |
EIP fragment shown correctly.
Diffstat (limited to 'app/src/release')
-rw-r--r-- | app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java | 10 | ||||
-rw-r--r-- | app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java | 29 |
2 files changed, 24 insertions, 15 deletions
diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index d54b9a30..ef7986f1 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -251,7 +251,11 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download //TODO Code 2 pane view selected_provider = adapter.getItem(position); onItemSelectedUi(selected_provider); - setUpProvider(selected_provider.mainUrl()); + onItemSelectedLogic(selected_provider); + } + + private void onItemSelectedLogic(Provider selected_provider) { + setUpProvider(selected_provider.mainUrl()); } private void onItemSelectedUi(Provider provider) { @@ -402,7 +406,8 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download private void autoSelectProvider(Provider provider) { selected_provider = provider; - //onItemSelected(provider); + onItemSelectedUi(selected_provider); + onItemSelectedLogic(selected_provider); } /** @@ -469,6 +474,7 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download @Override public void login() { Intent ask_login = new Intent(); + ask_login.putExtra(Provider.KEY, selected_provider); ask_login.putExtra(LogInDialog.TAG, LogInDialog.TAG); setResult(RESULT_OK, ask_login); setting_up_provider = false; diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index 0fa60550..fc74b702 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -58,7 +58,7 @@ public class ProviderAPI extends IntentService { ERRORS = "errors", UPDATE_PROGRESSBAR = "update_progressbar", CURRENT_PROGRESS = "current_progress", - TAG = ProviderAPI.class.getSimpleName(); + TAG = ProviderAPI.class.getSimpleName() ; final public static int @@ -72,9 +72,7 @@ public class ProviderAPI extends IntentService { CORRECTLY_DOWNLOADED_CERTIFICATE = 9, INCORRECTLY_DOWNLOADED_CERTIFICATE = 10, PROVIDER_OK = 11, - PROVIDER_NOK = 12, - CORRECTLY_DOWNLOADED_ANON_CERTIFICATE = 13, - INCORRECTLY_DOWNLOADED_ANON_CERTIFICATE = 14 + PROVIDER_NOK = 12 ; private static boolean @@ -100,14 +98,9 @@ public class ProviderAPI extends IntentService { @Override public void onCreate() { super.onCreate(); + preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE); CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ORIGINAL_SERVER)); - if(provider_api_url == null && preferences.contains(Provider.KEY)) { - try { - JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, "")); - provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); - } catch (JSONException e) {} - } } public static String lastProviderMainUrl() { @@ -123,7 +116,16 @@ public class ProviderAPI extends IntentService { final ResultReceiver receiver = command.getParcelableExtra(RECEIVER_KEY); String action = command.getAction(); Bundle parameters = command.getBundleExtra(PARAMETERS); - setting_up_provider = true; + + if(provider_api_url == null && preferences.contains(Provider.KEY)) { + try { + JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, "")); + provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); + setting_up_provider = true; + } catch (JSONException e) { + setting_up_provider = false; + } + } if(action.equalsIgnoreCase(SET_UP_PROVIDER)) { Bundle result = setUpProvider(parameters); @@ -360,7 +362,7 @@ public class ProviderAPI extends IntentService { * Sends an HTTP POST request to the api server to register a new user. * @param server_url * @param username - * @param salted_password + * @param salt * @param password_verifier * @return response from authentication server */ @@ -477,6 +479,7 @@ public class ProviderAPI extends IntentService { if(task != null && task.containsKey(Provider.MAIN_URL)) { last_provider_main_url = task.getString(Provider.MAIN_URL); CA_CERT_DOWNLOADED = PROVIDER_JSON_DOWNLOADED = EIP_SERVICE_JSON_DOWNLOADED = false; + setting_up_provider = true; } if(!PROVIDER_JSON_DOWNLOADED) @@ -684,7 +687,7 @@ public class ProviderAPI extends IntentService { /** * Tries to download the contents of the provided url using not commercially validated CA certificate from chosen provider. - * @param url as a string + * @param url_string as a string * @return an empty string if it fails, the url content if not. */ private String downloadWithProviderCA(String url_string) { |